标签栏消失了 - 我怎样才能强迫它留下来?
我终于在我的程序中实现了一个标签栏(花了我比我想象的更长的时间)。问题是,一旦用户单击视图中的按钮,它就会消失。我知道导航应该由选项卡栏完成,我仍然需要用户单击按钮来保存数据。您可能会说我可以让他保存数据,然后让他单击自己的选项卡栏以查看他输入的内容。但不,我希望他能够在标签栏保持活动状态的同时进入视图。有谁知道如何做到这一点?
当用户点击按钮时会发生这种情况:
(button.tag = 9001);
UIButton *buttonPressed = (UIButton *)sender;
SecondView *second =[[SecondView alloc] initWithNibName:nil bundle:nil];
second.buttonTag = buttonPressed.tag;
[self presentModalViewController:second animated:YES];
我忘了提及:因为我需要核心数据和东西,所以我没有制作选项卡栏应用程序,而是稍后添加了选项卡栏(确切地说是现在)。我按照SEG在他的回答中描述的那样做了-> 使用 Interface 将 tabbarcontroller 添加到 AppDelegate 的步骤XCode 4.2 空应用程序模板中的构建器
I finally implemented a tabbar (took me way longer than I thought) in my program. Problem is that it vanishes as soon as the user clicks on a button in a view. I know that the navigation should be done by the tabbar, I still need the user to click the button to save data. You might say I could just let him save the data and then let him click on his own the tabbar to see what he entered. But no, I want him to be able to get to the view, while the tabbar stays active. Does anyone have an idea how to do that?
This happens when the user taps button:
(button.tag = 9001);
UIButton *buttonPressed = (UIButton *)sender;
SecondView *second =[[SecondView alloc] initWithNibName:nil bundle:nil];
second.buttonTag = buttonPressed.tag;
[self presentModalViewController:second animated:YES];
I forgot to mention: Because I need the coredata and stuff I didn't make a tabbar application but added the tabbar later on (just now to be exact). I did it like SEG described in his answer -> steps to add tabbarcontroller to AppDelegate using Interface Builder in XCode 4.2 Empty Application template
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
presentModalViewController 显示覆盖导航栏的新视图控制器。不确定在这种情况下您的 UI 需要是什么,但是
当您准备关闭视图
以返回到第一个视图时,您可以使用 Then 显示新的视图控制器。
presentModalViewController shows the new view controller covering up the navigation bar. Not sure what you UI needs to be for this case, but you could show the new view controller using
Then when you are ready to close the view
to get back to the first view.