开发者

UISegmentedControl autoresizingMask not working

I placed a UISegmentedControl programmatically on the screen (stand-alone, not as part of a navigation bar) and set its autoresizingMask to UIViewAutoresizingFlexibleLeftMargin because I want it to stick to the right.

However, when 开发者_JAVA百科I rotate the screen the control stays in its original position and does not move to the right (or anywhere else for that matter).

I also tried all other possible values (and some combinations) for the autoresizingMask, but the thing doesn't move at all.

Other elements on the screen with the same setting move correctly.

I do not have a XIB for this view controller, but I tried to place a similar segmented control temporarily in another XIB, and when I set the struts correctly it did move as expected.

What am I doing wrong?


In your view controller's viewDidLoad method place the following log statement:

NSLog(@"%@", [self.view recursiveDescription]);

This will log out your view controller's view hierarchy. If it's not clear from the log where the issue is, then please add the log to your question so we can help further.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜