开发者

How to use a segmented control in the toolbar to switch views?

As it has been asked many times, I am trying to switch views by using a segmented control correctly. I cannot just hide/display because the views are too complicated.

I have gotten it to work using this solution from this answer, but this places the segmented control in the title bar. I would like to palce it on the bottom, in a toolbar.

I have tried hooking it up via IB and declaring each开发者_StackOverflow社区 subviews control, but no luck. I think it has something to do with the @selector section.

Can someone please shed some light on this for me?


UIBarButtonItem *item = [[[UIBarButtonItem alloc] initWithCustomView:segmentedControl] autorelease];

// if you are in a navigation controller:

[self.navigationController setToolbarHidden:NO];
self.toolbarItems = [NSArray arrayWithObject:item];

// else, created a UIToolBar called toolBar at the bottom of the view and...

toolBar.items = [NSArray arrayWithObject:item];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜