从 XIB 中引用以编程方式创建的 UINavigationBar

发布于 2024-10-03 05:13:05 字数 1129 浏览 1 评论 0原文

我从另一个关于如何将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何以心动 2024-10-10 05:13:05

我刚刚才明白!!!!

要将视图控制器推入堆栈,它会自动知道哪个导航控制器将其称为自己的并具有对该视图控制器的引用,您只需执行以下操作:

[self.navigationController pushViewController:nameofcontroller animated: YES];

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:

[self.navigationController pushViewController:nameofcontroller animated: YES];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文