Reputation: 33090
This is like how to disable part of uisegment control?
Except that rather than disabling it I want to just hide it. Is it even possible?
Upvotes: 1
Views: 779
Reputation: 19418
You could try with this :
[segmentCnt setTitle:@"" forSegmentAtIndex:index];
[segmentCnt setWidth:0.1 forSegmentAtIndex:index];
Also, you need to remove text/title of that segment to hide it.
Upvotes: 0
Reputation: 1
Create a UIView and place it over the segment you want to disappear, provided the UIView would be filled with a color or image (if you use a UIImageView) that would match the view behind the segment control.
Then you could hide it or show it as needed, covering the segment.
Upvotes: 0
Reputation: 9913
AFAIK you can't hide segments. You'll have to remove it if you want it to disappear. Just call
- (void)removeSegmentAtIndex:(NSUInteger)segment animated:(BOOL)animated
and you can remove the segment you don't want to show. You can add it back with
- (void)insertSegmentWithTitle:(NSString *)title atIndex:(NSUInteger)segment animated:(BOOL)animated
or
- (void)insertSegmentWithImage:(UIImage *)image atIndex:(NSUInteger)segment animated:(BOOL)animated
Upvotes: 2