Friday, 15 June 2012

ios - How can I check that a label has fallen off the screen? -


I have a question about UIKit dynamics. Suppose I am preparing some interactivity, and when the user gets fired, I want a label with some text to drop from the screen (at which point I will destroy it, and a new label will fall from above Will go and fall, the picture to the center, and when the user faucets, he also stops the screen, and it goes.)

  Import UIKit class ViewController: UIViewController {var myLabel: UILabel ! Var gravity: UIGravityBehavior! Var animator: UIDynamicAnimator! Overlapped Function ViewDidload () {super.webdeload () myLabel = UILabel (frame: CGRXX (X: 100, Y: 100, width: 100, height: 100)) myLabel.backgroundColor = UIColor.blueColor () myLabel.text = " Some sample text. "View: Adsubiewue (My Labels) Animator = UIDPNEnitor (refer to reference) Gravity = UIGravityVihaiar (item: [MYBELD]) Animator.AdbieVier (gravity)}  

The above code is a UILB and remove it from the screen I think How to do all this. However, how do I decide whether the label has fallen completely from the scene, whether it is removed at that point or not, and my new label can fall from the top and fall is.

I am using a method to determine whether the label is hiding with the view (like CGRectIntersectsRect ())? Or should I try and check that the centerpiece of the label is within the scope of the screen or not? I have tried to hook up a solution using both of these options, but nothing is working till now. Any suggestions?


No comments:

Post a Comment