简体   繁体   中英

how to add UItabBarController as a subview

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM