0

I need help on this thing. I have 3 view controllers say Parent and Child1, Child2

in Parent viewcontollers I have a view called container and a segmented control.

Now I want that content of this 'container' view change with animation everytime the value of segmented control is changed.

I have done till here please tell me what needs to be added:

if (selectSearchType.selectedSegmentIndex==0) {



    [aAdvanceSearchViewContoller.view removeFromSuperview];
    [container addSubview:aBasicSearchViewController.view];

}else {
    NSLog(@"Advance Search");
    [aBasicSearchViewController.view removeFromSuperview];
    [container addSubview:aAdvanceSearchViewContoller.view];
}
Ankit Sachan
  • 7,690
  • 16
  • 63
  • 98

1 Answers1

5

Add the following lines to your code:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.75];
[UIView setAnimationDelegate:self];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:myview cache:YES];
[myview removeFromSuperview]; //remove or addSubview as required
[UIView commitAnimations];
HG's
  • 818
  • 6
  • 22
  • Also check out the following link: http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice – HG's Mar 09 '11 at 13:48