问题描述:

I am using a UIToolBar with multiple UIButtonItems. These button items need to bring up a modal view controller(VC) for setting parameters via pickers sliders etc.

The question is do I use a single VC for all the button items vs separate VCs for each button ?

Right now I am using only one and bringing the proper subview to front hiding others etc but it seems to be getting tedious particularly with differing nav bar headings, view sizes etc.

So what is the right way - a single VC or separate vc for each UIButtonItem on the UIToolBar ?

网友答案:

You should be using a UINavigationController and pushing new view controllers onto the navigation stack as you need them, and popping them off when you're done. This allows you to separate your functionality into separate discrete components which is helpful for code organization as well as adhering more closely to Apple's guidelines provided in the HIG.

I would definitely suggest breaking it out into separate view controllers.

相关阅读:
Top