Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lawicko

macrumors member
Original poster
Jul 17, 2008
44
0
Hi,
I have some questions about UISegmentedControl. I want to create control with 2 segments, and I don't want it to be momentary. The result is that no matter which segment I touch, UIControlEventValueChanged is send to my selector. This is really annoying :mad:
I was trying to find out what's going on, and studied two examples:
1. UICatalog has the example of segmented control, but it has 3 segments, not two. When I add another segment to my control, it starts to behave as I want. Unfortunately, for 2 segments the behavior is different from expected. The fact that I have only 2 segments does not mean that whenever I touch I want to change the state...
2. NavigationBar example has nice segmented control, and it behaves almost as I would like mine to behave. The problem is that it's momentary, so the segments don't stay in selected state, they go back to normal.

So if anyone of you guys has good idea how to implement segmented control as described above - please give me some hints. Thanks in advance.
 

braziliphone

macrumors newbie
Sep 22, 2007
10
0
Hi,

don't know if you have already figured it out, but I use:
- (void)setAlwaysToggleForTwoSegments:NO;

Hope that helps,
Rafael
 

lawicko

macrumors member
Original poster
Jul 17, 2008
44
0
Hi, thanks for the reply!
Looks like really simple solution, but where did you get that method from? I don't see it in UISegmentedControl class reference... Is it similar to terminate method of UIApplication class - so it's not documented but it's there?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.