3

I am building an iPhone app and I have implemented a section for knowledge base about the app's subject matter. I used a table view and navigation viewController so that upon selecting any cell in the table a new view controller will be created and added on to the navigation stack.

I tried to implement the curl up/ down animation myself but i get this error at runtime

Parent view controller is using legacy containment in call to -[UIViewController transitionFromViewController:toViewController:duration:options:animations:completion:]'

here is the code sample

(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

// change the accessory button to activity indicator
UITableViewCell *cell = [mTableView cellForRowAtIndexPath:indexPath];


SomeViewController *ad = [[SomeViewController alloc] initWithNibName:@"SomeViewController" bundle:[NSBundle mainBundle]];
ad.title = cell.textLabel.text;


[self.navigationController addChildViewController:ad];
[self.navigationController transitionFromViewController:self toViewController:ad duration:0.7 options:UIViewAnimationOptionTransitionCurlUp animations:^{} completion:^(BOOL completed){
    [ad release];
}];

Any help, advice and tips is very much appreciated! Thanks!

shawndreck
  • 63
  • 8

1 Answers1

6

Hey I got the same exception when my custom containment view controller was a subclass of UINavigationViewController. When I made my containment vc a subclass of UIViewController it worked like a charm. Your problem might be different. From the apple docs:

This method is only intended to be called by an implementation of a custom container view controller. If you override this method, you must call super in your implementation.

You are calling this method on a UINavigationViewController instance, not on an instance of a custom container view controller.

Tylerc230
  • 2,883
  • 1
  • 27
  • 31