如何从子视图导航到另一个视图

时间:2011-04-25 13:26:08

标签: iphone objective-c uinavigationcontroller

我想从子视图导航到另一个视图。我编写了代码,但它正在从这个视图导航。请帮我解决这个问题。

NSLog(@"selected tag:%d",[sender tag]);
UserViewController *uViewController=[[UserViewController alloc] initWithNibName:@"UserViewController" bundle:nil];
uViewController.usersArray=self.usersArray;
uViewController.accessingIndex=[sender tag];
self.userViewController=uViewController;

[self.navigationController pushViewController:self.userViewController animated:YES];
[uViewController release];

1 个答案:

答案 0 :(得分:1)

您可以使用此方法显示视图

[self presentModalViewController:uViewController animated:YES]

要关闭它,请使用:

[self dismissModalViewControllerAnimated:yes]