Subscribe ( )

iPhone Programming Tutorials


 

Forum

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];

}

Search 

About the iCodeBlog forum

Most Users Ever Online:

44


Currently Online:

4 Guests

Forum Stats:

Groups: 2

Forums: 6

Topics: 419

Posts: 893

Membership:

There are 934 Members

There has been 1 Guest

There are 2 Admins

There is 1 Moderator

Top Posters:

bobcubsfan – 54

crazyiez – 30

Uhu – 17

AdeC – 17

Nick – 15

jitesh61 – 12

Administrators: Brandon (88 Posts), Collin (0 Posts)

Moderators: VertigoSol (26 Posts)



©   

  • Posted by on 6 Aug 2008 in Uncategorized
  •   |  
  •   |  
  •   |  
  • Comments Off

Comments are closed.