Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are targeting iOS 4.0 or greater then you can use the <a href="http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html#//apple_ref/doc/uid/TP40009503-CH6-SW1" rel="nofollow">new block based class methods</a> to start animatable changes to <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html" rel="nofollow">view</a> objects. So from your touch event you can initiate an animatable change to properties on the view:</p> <pre><code>[UIView animateWithDuration:1.0 animations:^{ yourView.alpha = 0.0; // fade out yourView over 1 second }]; </code></pre> <p><strong>N.B.</strong> This could just as easily be a change to another property on the view, like its location. You can animate the following properties on the view this way:</p> <pre><code>@property frame @property bounds @property center @property transform @property alpha @property backgroundColor @property contentStretch </code></pre> <p>If you are targetting earlier versions of iOS you will need to use UIView <a href="http://developer.apple.com/library/ios/documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/clm/UIView/beginAnimations%3acontext%3a" rel="nofollow">beginAnimations</a> and <a href="http://developer.apple.com/library/ios/documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/clm/UIView/commitAnimations" rel="nofollow">commitAnimations</a> methods to create an animation block:</p> <pre><code>[UIView beginAnimations:nil context:context]; [UIView setAnimationDuration:1.0]; yourView.alpha = 0.0; [UIView commitAnimations]; </code></pre> <p>This stuff works really well and once you start using it, you will have to be careful you don't get addicted. ;)</p> <p><strong>Update for comment:</strong></p> <p>You can bind the position of the marble to the location of the touch event. Once you get the <a href="http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/instm/UIResponder/touchesEnded%3awithEvent%3a" rel="nofollow">touchesEnded</a> event you can then animate the location of the marble using an animation block.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload