Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 20th, 2012  |  syntax: None  |  size: 0.77 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Objective C moving Labels
  2. -(void)doTheLabelThing {
  3.  
  4.     // assume all the labels are in a container view that is 320 wide and 100 tall
  5.     self.labelContainer.frame = CGRectMake(0, -100, 320, 100);
  6.  
  7.     [UIView animateWithDuration:0.5 animations:^{
  8.         // slide down
  9.         self.labelContainer.frame = CGRectMake(0, 360, 320, 100);
  10.     } completion:^(BOOL finished) {
  11.         // give user 3 seconds to read it
  12.         [UIView animateWithDuration:0.5 delay:3.0 options:0 animations:^{
  13.             // fade out
  14.             self.labelContainer.alpha = 0.0;
  15.         } completion:^(BOOL finished) {
  16.             // restore everything to original state
  17.             self.labelContainer.alpha = 1.0;
  18.             self.labelContainer.frame = CGRectMake(0, -100, 320, 100);
  19.         }];
  20.     }];
  21. }