Sunday, 7 July 2013

Animation

I love animation. They are interesting to look at. Here is a simple code to animate label. - (void)viewDidLoad { [super viewDidLoad]; self.label.frame = CGRectMake(0, 100, self.label.frame.size.width, self.label.frame.size.height); [self.view addSubview:self.label]; CGRect endFrame = CGRectMake(0, 0, self.label.frame.size.width, self.label.frame.size.height); [UIView animateWithDuration:1 animations:^{ self.label.frame = endFrame;}]; } Code animation has built in deceleration. It is fun to play with it.

No comments:

Post a Comment