UIView animation doesn't work first time

Posted by BobC on Stack Overflow See other posts from Stack Overflow or by BobC
Published on 2010-05-05T13:53:28Z Indexed on 2010/05/05 13:58 UTC
Read the original article Hit count: 323

Filed under:
|
|

Hello everybody, I have a seachButton in the navigation bar which upon hitting calls following method:

- (IBAction)search:(id)sender
{
if (nil == searchViewController)
    searchViewController = [[SearchViewController alloc] initWithNibName:@"SearchViewController" bundle:nil];

searchViewController.view.backgroundColor = [UIColor clearColor];

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
                       forView:searchViewController.view
                         cache:NO];

[self.view addSubview:searchViewController.view];
[UIView commitAnimations];
}

It should load SearchViewController.xib which contains a view with UISearchBar and two buttons. When I call the search method for the first time, the view appears very quickly with some weird animation, when I call it again, the animation is alright. Does anyone have a clue what could be wrong?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about animation