【发布时间】:2012-01-24 05:03:36
【问题描述】:
我有一个基于导航的应用程序。单击第一个屏幕导航栏上的按钮时,我可以按如下方式推送另一个视图控制器:
-(void) buttonClicked:(id)sender
{
UIViewController* mv = [[SecondViewController alloc] init];
[[self navigationController] pushViewController:mv animated:YES];
}
现在我有一个 UIView(单独的 .h 和 .m 文件)作为第一个屏幕的一部分。单击 UIView 中的按钮时,我想推动 SecondViewController。 我尝试了以下方法:
UIViewController* mv = [[SecondViewController alloc] init];
UIViewController * home=[[FirstViewController alloc]init];
[[home navigationController] pushViewController:mv animated:YES];
没有用!!请帮忙
【问题讨论】:
-
试试 [self.navigationController popToRootViewController animated:YES];
-
UIView 没有“navigationController”属性。
-
房间里的大象是:这个 UIView 到底是什么东西?如果没有容器,你不能将 UIView 推送到堆栈中......而且将他的第一个视图包含在 UIViewController 或 UINavigationController 中并在启动时将其覆盖在主窗口上要比仅在其上放置 UIView 要容易得多...
标签: ios uiview uiviewcontroller uinavigationcontroller