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];
精彩评论