从 XIB 中引用以编程方式创建的 UINavigationBar
我从另一个关于如何将 UINavbars 添加到 UIToolBar 的 stackoverflow 答案中得到了一些代码,
我在这里确实感到有点愚蠢,因为我无法弄清楚如何从我希望它显示的笔尖引用新创建的 NavController...这这就是我正在做的事情。我知道我一定在这里混淆了一些东西:(
在我的应用程序委托中,我创建了控制器数组:
UINavigationController *rvc_tools = [[UINavigationController alloc]
initWithRootViewController: navController_tools];
UINavigationController *rvc_settings = [[UINavigationController alloc] initWithRootViewController:navController_settings];
aboutIVacation* vc_about = [[aboutIVacation alloc] init];
myCurrent *mycurrentpage = [[myCurrent alloc] init];
UINavigationController *rvc_mysynchpage = [[UINavigationController alloc] initWithRootViewController:navController_synch];
//然后我将其添加到选项卡栏:
<code> NSArray* controllers = [NSArray arrayWithObjects: mycurrentpage, rvc_tools,rvc_settings, vc_about, rvs_mysynchpage, nil];</code>
[iVacationTabBar setViewControllers:控制器动画:NO]; 所以现在如果我想要 rvc_mysynchpage 加载我的名为“synch”的 xib,我该如何告诉它加载它,一旦我进入我的名为synch的 xib,并且我有一个我想要按下的按钮,它显示将另一个视图推到顶部来做某事,我如何让它推动新的观点。
如果我尝试调用 rvc_mysynchpage 它会告诉我它未声明......
I got some of this code from another stackoverflow answer of how to add UINavbars to a UIToolBar
I do feel a little dumb here because I cant figure out how to reference a newly created NavController from the nib that I want it to display... this is what I am doing. I know I must have mixed something up here :(
In my app delegate I created the array of controllers:
UINavigationController *rvc_tools = [[UINavigationController alloc]
initWithRootViewController: navController_tools];
UINavigationController *rvc_settings = [[UINavigationController alloc] initWithRootViewController:navController_settings];
aboutIVacation* vc_about = [[aboutIVacation alloc] init];
myCurrent *mycurrentpage = [[myCurrent alloc] init];
UINavigationController *rvc_mysynchpage = [[UINavigationController alloc] initWithRootViewController:navController_synch];
//And then I added it to the tab bar:
<code> NSArray* controllers = [NSArray arrayWithObjects: mycurrentpage, rvc_tools,rvc_settings, vc_about, rvs_mysynchpage, nil];</code>
[iVacationTabBar setViewControllers: controllers animated:NO];
So now if I want rvc_mysynchpage to load my xib called "synch" how do I tell it to load that and once I am in my xib called synch and I have a button I want to push that shows pushes another view on top to do something, how do I have it push the new view.
If I try to call rvc_mysynchpage it will tell me its undeclared....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚才明白!!!!
要将视图控制器推入堆栈,它会自动知道哪个导航控制器将其称为自己的并具有对该视图控制器的引用,您只需执行以下操作:
I just figured it out!!!!
To push a view controller on to the stack, it knows automatically what nav controller called it their and has that reference to it, you just do this: