how to add UItabBarController as a subview

别来无恙 提交于 2019-12-25 01:56:09

问题


I have made a TabBar project using xcode's templates and I have the tabbar in the mainwindow.xib ofcourse.

once after the user logs into the app, I redirect them to a page called notifications, [self presentModalViewController:controller animated:YES]; but the tabbar doesnt show up.

now how can I either include the tabbar in the code above or get the tabbar from mainWindow.xib and display it once the UIView is loaded?

Thanks


回答1:


Does your 'log in' view display the TabBar? If so, that's because your 'log in' view controller is a child of the TabBar view controller. Your modal view does not show the TabBar because it's controller is not a child of the TabBar view controller.

You may want to reconsider the design of you app. A modal view controller is usually presented as temporary deviation from the main workflow. See the View Controller Programming Guide for iOS - Modal View Controllers

You could swap things around. Have the main contents of your app in the TabBar, and upon the app launch, if the user is not already logged in, present your 'log in' view as a Modal View. Then dismiss it once the user logs in.



来源:https://stackoverflow.com/questions/7375002/how-to-add-uitabbarcontroller-as-a-subview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!