Anyone had a smiliar bug? The control is placed from Interface Builder and not modified in any way by code. It was working fine until some time ago after a random build the bug appeared. Happens in two places in my app while the same exact kind of setup is fine inside another viewcontroller. In all cases the controls are inside a UINavigationItem. Deleting the control and re adding it didn't change anything. This only appreas on an actual device, never in the simulator.
A:
Have you tried setting the explicit component widths or adjusting the control's autoresizing property:
Chris Gummer
2010-06-04 11:49:35
Yes and no. Setting the autoresizing property fixes the bug, but only when the view controller doesn't get pushed onto the screen via a uitabbarcontrollers moreviewcontroller. Ie, if I set the selected index on my main tabbar to 5, it displays fine, but if I navigate there through the more menu, it's no dice.
Joonas Trussmann
2010-06-07 09:27:29
Do you have a sample app that demonstrates this behaviour, that you can share?
Chris Gummer
2010-06-07 23:24:45
I'm afraid I don't at the moment, but I'll try to see if I can replicate this with a new app.
Joonas Trussmann
2010-06-08 08:20:53
A:
Have you tried creating it programatically? It definitely seems to be a bug, but this approach might negate the bugs.
Declare an IBOutlet for the UINavigationItem:
IBOutlet UINavigationItem *navItem;
then when it loads do:
segCont=[[UISegmented Control alloc] initWithItems:[NSArray arrayWithObjects:@"item 1", @"item 2", nil]];
segCont.segmentedControlStyle=UISegmentedControlStyleBar; //Optional, but in a toolbar it looks best
navItem.titleView=segCont;
[segCont autorelease];
I have not tested this code, but if it doesn't work please comment... (It may still be under the influence of the bug, however)
Tom H
2010-06-09 21:33:09
That kind of defeats the purpose of having my view hierarchy loaded from nibs, but I'll give it a try nonetheless.
Joonas Trussmann
2010-06-09 22:26:28
A:
Since none of the solutions proposed actually fixed the issue properly I guess the only solution seems to be to just upgrade to the 4.0 SDK, which seems to fix the issue.
Joonas Trussmann
2010-06-29 09:48:37