开发者

Where add toolbar with a SegmentedControl in IB?

I have a NavigationController in MainWindo开发者_高级运维w.xib. It loads a RootViewController that basically manages a TableView (in the .xib there is a view which contains the table view and a search bar). Now I'd like to add a segmented control to switch between the table view and a map view. My idea is to manage the map view with the same RootViewController and for this I'll create a view with a map view and a search bar in RootViewController.xib

But where I can put the toolbar with the segmented control? It must be visible both in the table and the map view, but I don't succeed in achieving this.

Thanks

Fran


I think what you want to do is put the map and table views in another container UIView. Then you can show/hide or swap the two views within that container. Then you can reduce the height of the container view by 44px and drop in a toolbar. In IB you shield be able to drop a segmented control onto the toolbar and voila. So your root view controller contains two items at the top level: A toolbar and a generic UIView container. The map and table view will be subviews of the container and you can use the valueChanged UIControlEvent on the segmented control in the toolbar to call a method to swap the map and table views.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜