Subscribe ( )

iPhone Programming Tutorials

 

Forum

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

You must be logged in to post Login Register

Search 

animate properties of multiple views at the same tim

User Post

1:51 pm
March 14, 2009


spohle

Noob

posts 2

1

hi,


i am following an example from apple (HeadsUpDisplay), which is bringing up one HUD (alpha and position). now i expanded that example to change 2 views at the same time. the first view is doing fine but the second one acts like he has a hiccup. it doesn't fade in the alpha and the position animation is much faster than the first one. here's the code:


- (void)showHoverViews:(BOOL)show

{

// reset the timer

     [myTimer invalidate];

     [myTimer release];

myTimer = nil;

     

// fade animate the view out of view by affecting its alpha

     [UIView beginAnimations :nilcontext:NULL];

     [UIView setAnimationDuration:0.40];

     

     if (show)

     {

// as we start the fade effect, start the timeout timer for automatically hiding HoverView

editHoverView.alpha = 1.0;

          CGRect frame = editHoverView.frame;

          frame.origin.y = self.view.frame.size.width - frame.size.height;

          editHoverView.frame = frame;

          

infoHoverView.alpha = 1.0;

          frame = infoHoverView.frame;

          frame.origin.y = 0;

          infoHoverView.frame = frame;

          

myTimer = [[NSTimer timerWithTimeInterval : 3.0target:selfselector:@selector(timerFired:) userInfo:nil repeats:NO] retain];

          [[NSRunLoop currentRunLoop] addTimer:myTimer forMode:NSDefaultRunLoopMode];

     }

else

     {

          CGRect frame = editHoverView.frame;

          frame.origin.y = self.view.frame.size.width;

          editHoverView.frame = frame;

editHoverView.alpha = 0.0;

          

          frame = infoHoverView.frame;

          frame.origin.y = 0 - self.view.frame.size.width;

          infoHoverView.frame = frame;

infoHoverView.alpha = 0.0;

     }

     

     [UIView commitAnimations];

}

- (void)timerFired:(NSTimer *)timer

{

// time has passed, hide the HoverView

     [self showHoverViews: NO];

}


About the iCodeBlog forum

Currently Online:

5 Guests

Maximum Online: 25

Forums:

Groups: 2

Forums: 6

Topics: 293

Posts: 729

Members:

There are 625 members

There are 1 guests


Brandon has made 87 posts

Top Posters:

bobcubsfan - 53

crazyiez - 30

VertigoSol - 26

AdeC - 17

Uhu - 17

Administrator: Brandon | Moderators: VertigoSol


© - Version 3.1.4 (Build 357)