I have a view that has a UIWebView and a options panel (a custom UIViewController with a custom view).
I want, when the view is displayed, for the options bar (located at the top of the main view), so that FLIP snaps into place. I use code and I get a weird result.
The first time the view is displayed, the options bar seems already visible ... When I click BACK on my navController and pull the View again, the animation works fine.
Can someone shed some light on this topic?
- (void)viewDidLoad {
[super viewDidLoad];
optionsPane=[[OptionsPaneController alloc] initWithNibName:@"OptionsPane" bundle:nil];
}
- (void)viewWillAppear:(BOOL)animated {
[optionsPane.view removeFromSuperview];
[self checkOptionsVisible];
}
-(void)checkOptionsVisible{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:[optionsPane view] cache:YES];
[[self view] addSubview:[optionsPane view]];
[theWebView setFrame:CGRectMake(0,87,320,230)];
[[optionsPane view] setFrame:CGRectMake(0,0,320,87)];
[UIView commitAnimations];
}
source
share