0

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 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?

Community
  • 1
  • 1
Joe Masilotti
  • 16,422
  • 6
  • 73
  • 86

1 Answers1

0

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];
Michael Frederick
  • 17,057
  • 3
  • 41
  • 57