views:

25

answers:

0

I have a three item Tab Bar which works fine. On occasion I need to switch to a view not from the Tab Bar item but via an IBAction (button press) instead. Again this works fine with [self.tabBarController setSelectedIndex:1]; I want to switch to this view however with a PageCurlu transition effect. I use this to do it:

EstimateController *estimateView = [[EstimateController alloc] initWithNibName:@"EstimateController" bundle:nil]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES]; [self.view addSubview:estimateView.view]; [UIView commitAnimations];

This works fine except, it disables the Tab Bar item view controller where the IBAction (UIButton) is which was used to change the view. To get around this I have tried to combine both techniques (I know it's not the most elegant way but I can't find another .... unless you know different). So I have

EstimateController *estimateView = [[EstimateController alloc] initWithNibName:@"EstimateController" bundle:nil]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES]; [self.view addSubview:estimateView.view]; [UIView commitAnimations]; [self.tabBarController setSelectedIndex:1];

to change the view with a page CurlIp transition followed immediately by a change view - to the same view - using the setSelectedIndex to reposition the Tab Bar item.

This doesn't work! Is there a better way of achieving this?