开发者

How to add uinavigation controller to tabbar based application

开发者 https://www.devze.com 2023-01-15 17:07 出处:网络
i am making a tabbar based app, but the problem is I have several views like login view and a tableview that has to be shown before the tabbar view. My problem is if take a tabbar based application it

i am making a tabbar based app, but the problem is I have several views like login view and a tableview that has to be shown before the tabbar view. My problem is if take a tabbar based application it doesn't have a navigation controller, so when I want to push the another viewcontroller from the tableview controller it is not possible. The flow of my app would be:

first screen loginview -> TableView (rootviewcontroller) -->tabbar View.

I am adding the loginview from appdelegate using addSubviewmetho开发者_如何学编程d. Then from LoginViewController I do the following :

myAppDelegate *appDel=(myAppDelegate*)[[UIApplication sharedApplication]delegate];
[aapDel.view addSubview:myTableViewController.view];

Now if I want to push something from the myTableViewcontroller it does not respond. Moreover there is no navigation bar on the mytableviewcontroller.


Maybe, the easiest way here is to add UINavigationController to the main window (UIWindow). And hide it on the first screens? And then you can use self.navigationItem and self.navigationController in you code (from any view controller, pushed to UINavigationController) to push/pop other ViewControllers.


Simply create your own navigationController =)

0

精彩评论

暂无评论...
验证码 换一张
取 消