开发者

Center multiple labels when orientation changes?

开发者 https://www.devze.com 2023-03-20 23:32 出处:网络
I have an iPad screen with a UILabel title and three UILabels immediately below it.I can center the title by stretching out the dimensions of the title UILabel and centering within the label.How can I

I have an iPad screen with a UILabel title and three UILabels immediately below it. I can center the title by stretching out the dimensions of the title UILabel and centering within the label. How can I keep the UILabels below it centered when I change orientation?

Visually it should look something like this:

                        开发者_C百科               My Title
                                   Foo: 10 / Bar: 20 


You can group the 3 labels in a small UIView and configure that view in Interface Builder to always stay centered horizontally (with the autosizing properties, just put all horizontal arrows and lines there to the dashed version instead of solid red).

Of course you need to have "autoresize subviews" on the parent UIView enabled for this to work

0

精彩评论

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