How to remove segmentedcontroller from uinavigationcontroller after view pops?
Posted
by cannyboy
on Stack Overflow
See other posts from Stack Overflow
or by cannyboy
Published on 2010-05-18T09:55:07Z
Indexed on
2010/05/18
10:00 UTC
Read the original article
Hit count: 320
I'm building a segmented control within my viewDidLoad method, like so:
NSArray *tabitems = [NSArray arrayWithObjects:@"ONE", @"TWO", nil];
UISegmentedControl *tabs = [[UISegmentedControl alloc] initWithItems:tabitems];
tabs.segmentedControlStyle = UISegmentedControlStyleBar;
tabs.frame = CGRectMake(185.0, 7.0, 130.0, 30.0);
tabs.selectedSegmentIndex = 0;
[self.navigationController.navigationBar addSubview:tabs];
[tabs release];
But when the user goes Back in the uinavigationcontroller hierarchy, the segmented controller stays on the navigation bar. How would I get rid of it? Or am I doing something fundamentally wrong?
© Stack Overflow or respective owner