在 Objective-C 中单击视图中的按钮后如何推送选项卡栏控制器?
我在视图中有一个按钮,我想在单击按钮后添加选项卡栏控制器。我该怎么做?
I have a button in a view, I want to add tab bar controller after click the button. How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先,我不认为将选项卡栏作为子视图作为一个好主意,
但如果您仍然想这样做,有很多方法可以解决
其中一个问题,首先使用 modalview
您必须添加这个创建按钮后的代码
将事件侦听器附加到您接下来的按钮
,您使事件函数执行选项卡栏推送
,并且不要忘记在 .m 中导入 tabbarcontroller 类头文件
希望这有所帮助;)
编辑:如果你需要去从选项卡栏视图返回到上一个菜单,您可以添加一个按钮,为其提供一个事件侦听器,然后将此代码放入函数中
first of all, i don't think pushing a tab bar as a subview as a good idea
but if you still want to do this, there's a lot of way to work around
one of them is by using modalview
first you have to add this code after you make the button
it attach an event listener to the button you have
next, you make the event function to do the tab bar pushing
and dont forget to import the tabbarcontroller class header file in your .m
hope this help ;)
edit : if you need to go back from the tab bar view into the previous menu, you can add a button, give it an event listener, and put this code inside the function
不要忘记创建相应的 nib 文件(dialerViewController.xib、SearchViewController.xib、DialerViewController.xib)并将这些视图高度设置为 411px(这是给你的)
谢谢
Don't forget to create the corresponding nib files(dialerViewController.xib, SearchViewController.xib, DialerViewController.xib) and make these views hight to 411px(this is unto you)
thanks
这是针对斯威夫特的
设置按钮操作,然后使用以下
示例:
This is for Swift
Set your button action then use this one
Example: