我的情况是我有两个视图,一个视图-> MoveView
应该可以在另一个视图-> FrameView
。 但是当移动内部视图时,可以将其移动到FrameView
之外! 希望所有的Views
不会打扰您; D!
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
var MoveViewLocation = CGPoint()
super.touchesBegan(touches , withEvent:event)
if let touch = touches.first as? UITouch {
MoveViewLocation = touch.locationInView(FrameView)
MoveView.center = MoveViewLocation
}
}