开发者

Inserting UIButton in interface builder to control the flow of my app

开发者 https://www.devze.com 2023-03-03 11:39 出处:网络
I have following set up in the interface builder: Files\' Owner First Responder App Delegate Window -> Tab Bar Controller

I have following set up in the interface builder:

  • Files' Owner
  • First Responder
  • App Delegate
  • Window
  • -> Tab Bar Controller
    • Tab Bar
    • ->Selected Navigation Controller (X)
      • Navigation Bar
      • ->X View Controller (X Class)
        • Navigation Item
      • Tab Bar Item (X)
    • ->Navigation Controller (Y)
      • Navigation Bar
      • ->Y View Controller (Y Class)
        • Navigation Item
      • Tab Bar Item (Y)

X and Y tab bars have their own nib's.

In my app delegate, I add tab view controller to the main window view:

[window addSubview:tabController.view];
[window makeKeyAndVisible];

And all this works great. However, I now need to insert a view with two buttons. One button would take me to above explained tab controller view. The second button would take me to anot开发者_如何学运维her subview (not yet implemented) which will only have an other action button in its view.

I should be able to navigate back to the main window (two buttons) from any of the subviews.

Is this possible? How to do it?


I don't know if this helps, but probably what you need here is a UINavigationController. With such a controller, put as the main view controller of the app, you can create the two buttons, and when the user touches one of them, you change the navigation controller display using its pushViewController:animated: method.

In this way you obtain the classic backwards arrow button item in the toolbar of the new view that will permit you to go back to the home page.

0

精彩评论

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