即使将溢出设置为滚动,也无法使Google表单iframe处于叠加层中进行滚动,而是其下的背景在移动设备上不断滚动。即使将设备更改为台式机Chrome上的移动设备,它也可以在iframe中在台式机chrome / safari上正常滚动。
HTML:
<div class="modal fade" id="follow-modal" tabindex="-1" role="dialog" aria-labelledby="follow-modal">
<div class="modal-background"></div>
<div class="modal-wrapper">
<div class="survey-wrapper">
<iframe src="https://docs.google.com/forms/d/e/1FAIpQLScYLpClPexPWtT9UETnksKMKnzH5xRgs-UikH21Ktl6PhJQ-w/viewform?embedded=true" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
SCSS:
#follow-modal {
.modal-background {
background-color: rgba(0,0,0,.9);
}
.modal-wrapper {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
align-items: flex-start;
justify-content: center;
}
.survey-wrapper {
position: relative;
background-color: transparent;
text-align: center;
margin-top: 100px;
width: 700px;
-webkit-overflow-scrolling: touch;
overflow-y: scroll;
@media (max-width: $screen-md-min) {
margin-left: 10px;
margin-right: 10px;
}
iframe {
width: …Run Code Online (Sandbox Code Playgroud) 使用 SpriteKit,我如何平铺一个水平重复的 SKTexture 以填充 SKSpriteNode 的宽度?这就是我到目前为止所拥有的——仅拉伸纹理。
var header = SKSpriteNode()
let headerTexture = SKTexture(imageNamed: "inGameHeader-1.png")
header = SKSpriteNode(texture: headerTexture)
header.position = CGPoint(x: 0, y: CGRectGetMaxY(self.frame)-39)
header.size.width = CGRectGetWidth(self.frame)
header.size.height = 150
header.anchorPoint = CGPoint(x: 0,y: 1)
addChild(header)
Run Code Online (Sandbox Code Playgroud) 我正在寻找一个位于UITextView内部子串位置的SpriteKit节点.我如何检索CGPoint位置,以便我可以在那里定位SKNode?
let textFont = [NSFontAttributeName: UIFont(name: "GillSansMT", size: 30.0) ?? UIFont.systemFontOfSize(18.0)]
attrString1 = NSMutableAttributedString(string: "My name is Dug.", attributes: textFont)
textShown1 = CustomTextView(frame: CGRectMake(CGRectGetMidX(self.frame), 175 + (90 * paragraphNumber), CGRectGetWidth(self.frame) - 80, CGRectGetHeight(self.frame)-400))
textShown1.attributedText = attrString1
self.view?.addSubview(textShown1)
Run Code Online (Sandbox Code Playgroud) 我是编程新手,但是在过去两个月中,我在学习iOS的Swift方面取得了长足的进步。我正在做一个简单的打字游戏-我构造项目的方式是,我有一个隐藏的UITextView,可以检测玩家按下的字符,并将该字符串与可见的UITextView字符串匹配。
我现在想要做的是添加某种动画-我希望各个字母淡入/淡出
我已经创建了一个属性字符串,并将其添加到UITextView中,但我只是想不出一种方法来对字符串中的特定范围进行动画处理。我已经尝试使用一些类似的方法:
UIView.animateWithDuration(1, delay: 0.5, options: .CurveEaseOut, animations: {
self.stringForPlayer.addAttribute(
NSForegroundColorAttributeName,
value: UIColor.greenColor(),
range: NSRange(location: self.rangeOfText, length: 1))
self.textViewForPlayer.attributedText = self.textForPlayer
}, completion: { finished in
println("FINISHED")}
)
Run Code Online (Sandbox Code Playgroud)
没有运气。我认为也许UIView动画仅在视图对象本身上,而不能在属性字符串上使用。有什么想法甚至解决方法可以做到这一点?任何帮助表示赞赏,非常感谢!
只是学习闭包和嵌套功能.鉴于下面的嵌套函数:
func printerFunction() -> (Int) -> () {
var runningTotal = 0
func printInteger(number: Int) {
runningTotal += 10
println("The running total is: \(runningTotal)")
}
return printInteger
}
Run Code Online (Sandbox Code Playgroud)
为什么调用func本身有错误,但是当我将func分配给常量时没有错误?printAndReturnIntegerFunc(2)将2 Int作为参数传递给返回值?
printerFunction(2) // error
let printAndReturnIntegerFunc = printerFunction()
printAndReturnIntegerFunc(2) // no error. where is this 2 going??
Run Code Online (Sandbox Code Playgroud) 两个方面的问题:
var array = [1,2,3,4,5]
contains(array, 0) // false
var array2: NSArray = [1,2,3,4,5]
array2.containsObject(4) // true
Run Code Online (Sandbox Code Playgroud)
有没有办法搜索一个数组超过1的值?即.我可以在下面写下来搜索数组中的多个值,如果找到任何值,则返回true吗?问题的第二部分是我如何为NSArray做到这一点?
var array = [1,2,3,4,5]
contains(array, (0,2,3)) // this doesn't work of course but you get the point
Run Code Online (Sandbox Code Playgroud) 我已经看到这在其他问题中得到了解决 - 但我认为因为这个NSDictionary是通过下标访问的,所以它会抛出一些错误.
func pickRandomRecipe(arrayOfRecipes: NSArray) -> Dictionary<String,Any> {
let randomRecipeIndex = Int(arc4random_uniform(UInt32(arrayOfRecipes.count)))
//Could not cast value of type '__NSDictionaryI' (0x7fbfc4ce0208) to 'Swift.Dictionary<Swift.String, protocol<>>' (0x7fbfc4e44358)
let randomRecipe: Dictionary = arrayOfRecipes[randomRecipeIndex] as! Dictionary<String,Any>
return randomRecipe
}
Run Code Online (Sandbox Code Playgroud) ios ×6
swift ×6
sprite-kit ×2
animation ×1
arrays ×1
casting ×1
closures ×1
css ×1
dictionary ×1
function ×1
google-forms ×1
html ×1
iframe ×1
nsarray ×1
string ×1
subscript ×1
textures ×1
tiling ×1
uitextview ×1