Reputation: 49
I am trying to push a new viewController
into the navigationController
from a popoverController
but it doesnt work for me.
This is how I call to the popoverController
:
PdfDetailViewController *vc=[[PdfDetailViewController alloc] initWithNibName:@"PdfDetailViewController" bundle:nil];
UIViewController* popoverContent = [[UIViewController alloc] init];
UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(0,0, 400, 280)];
vc.contentSizeForViewInPopover = CGSizeMake(700, 390);
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:vc];
[self.popoverController presentPopoverFromRect:cell.frame inView:self.tableView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[popoverView release];
[popoverContent release];
This is my code from the popoverController
:
CommentsViewController *commentsViewController = [[CommentsViewController alloc] init];
commentsViewController.index = PdfID;
[self.parentViewController.navigationController pushViewController:commentsViewController animated:YES];
[commentsViewController release];
Nothing happen
Please help me... thank you!
Upvotes: 0
Views: 233
Reputation: 535231
You should start by cleaning up your code so that it makes sense. Right now you are creating a UIView called popoverView for no reason and then just throwing it away. You're just confusing yourself and it's harder to understand what you are trying to accomplish when you show meaningles code.
Once you've done that, what are you trying to accomplish? Is the problem that this line doesn't work: self.parentViewController.navigationController pushViewController:
? If so, I would suggest pulling it apart and logging to make sure that parentViewController
and navigationController
are the objects you think they are.
Upvotes: 0
Reputation: 2846
UIPopoverController doesn't have a NavigationController unless you add one yourself.
For example
MyViewController *myViewController =
[[MyViewController alloc]
initWithNibName:@"MuViewController"
bundle:[NSBundle mainBundle]];
UINavigationController *navController =
[[UINavigationController alloc]
initWithRootViewController:myViewController];
UIPopoverController *popover =
[[UIPopoverController alloc]
initWithContentViewController:navController];
Upvotes: 1