UISegmentedControl parts collapse to 0 width?

Have you tried setting the explicit component widths or adjusting the control's autoresizing property.

Up vote 1 down vote favorite share g+ share fb share tw.

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.

Iphone cocoa-touch uisegmentedcontrol link|improve this question asked May 7 '10 at 15:40Joonas Trussmann86315 69% accept rate.

If it helps, I had this happen with some code. At home on a prior version of Xcode, all was good. At work with 3.2.2, they collapsed.

Don't know my installed version at home. – Daniel Blezek May 7 '10 at 16:46 I take it you didn't manage to solve this? – Joonas Trussmann May 10 '10 at 10:43 Confirmed, building with (not just against) 3.1.3 fixes the bug while it appears consistently with 3.2. Guess I'll have to file a bug report.

– Joonas Trussmann May 10 '10 at 12:17.

Have you tried setting the explicit component widths or adjusting the control's autoresizing property: stackoverflow.com/questions/2936450/uise....

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 Jun 7 '10 at 9:27 Do you have a sample app that demonstrates this behaviour, that you can share? – Chris Gummer Jun 7 '10 at 23:24 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 Jun 8 '10 at 8:20.

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).

That kind of defeats the purpose of having my view hierarchy loaded from nibs, but I'll give it a try nonetheless. – Joonas Trussmann Jun 9 '10 at 22:26.

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.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions