Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS: simple animation
    primarykey
    data
    text
    <p>I want to create a simple animation changing alpha value:</p> <pre><code>[UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2]; [view1 setAlpha:0.00]; [UIView commitAnimations]; </code></pre> <p>Ok in this way I change the alpha value for two seconds and it works fine, but I want this thing: When alpha is 0 the animation must should start another time to alpha = 1 So the animation should be: alpha 0 -> alpha 1 -> alpha 0 -> alpha 1 -> ... and so on with a duration of two seconds. Can you help me?</p> <p>my complete code is</p> <pre><code>-(IBAction){ FirstViewController *firstViewController = [[[FirstViewController alloc] init]autorelease]; [firstViewController.label1 setAlpha:1.00]; [firstViewController.label2 setAlpha:1.00]; view = firstViewController.viewFirst; //this is my view and I copy in other view [self fadeOut:nil finished:nil context:nil];} - (void) fadeOut:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(fadeIn:finished:context:) ]; [view setAlpha:0.00]; [UIView commitAnimations]; } - (void) fadeIn:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(fadeOut:finished:context:) ]; [view setAlpha:1.00]; [UIView commitAnimations]; } </code></pre>
    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.
 

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