I have some Labels in xib file, which were sett up by constrains. But I want to make some easy animations. Here is idea: set elements out of screen then user open aplication and then animate it back. So problem is: to make elements out of screen, I implemented following code in viewWillAppear method, but it doesnt work:
-(void)viewWillAppear:(BOOL)animated{
CGFloat correction = self.view.bounds.size.width;
CGPoint center1 = self.icon.center;
center1.x += correction;
self.icon.center = center1;
}
and my animation code in viewDidAppear method:
[UIView animateWithDuration:0.8
delay:0.1
usingSpringWithDamping:1.0
initialSpringVelocity:1.0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
CGFloat correction = self.view.bounds.size.width;
CGPoint center1 = self.icon.center;
center1.x -= correction;
self.icon.center = center1;
} completion:^(BOOL finished) {
NSLog(@"ready");
}];
but if I paste code from viewWillAppear to viewDidAppear it works. But a bit weird. How to make it right?