我想在窗口坐标系中获取scrollView的原点.例如,目前,scollView的起源是(0,51).但是在窗口坐标系中它应该是51 + 44(导航栏高度)+20(状态栏高度)= 115.在窗口坐标系中,scrollView.frame.origin应该是(0,115).我尝试使用convertPoint:方法,但有时会得到(0,51)或(0,0).请提供解决方案.谢谢
for child in platformGroupNode.children {
CGPoint p = [child.superview convertPoint:child.center toNode:self.view ]
println(p)
}
Run Code Online (Sandbox Code Playgroud)
但是我不确定如何与SKSpriteNode孩子和SKNode父母一起使用。
我也没有运气尝试过
for child in platformGroupNode.children {
var pos = child.position
var viewPos = convertPoint(pos, toNode: self.parent!)
if viewPos.x < 0 {
println("Out of screen")
}
}
Run Code Online (Sandbox Code Playgroud)