0

I have a UIView that is sized to fit the entire screen minus 5 pixels on each side. I have set it to autoresize however this makes the view lose its 5 pixels on one side, and completely fills the sides when flipped horizontally. I need the 5 pixel buffer to exist in all orientations. Is there any way I can tweak the way auto resize works to make this happen?

My code:

[newsfeed setAutoresizingMask:UIViewAutoresizingFlexibleWidth];

Also, I have dragged one of the many views in from storyboard, and that one does not respond to the code above. How can I make it auto resize?

4

1 回答 1

0

当您还指定上边距和下边距是灵活的时,实际上是说左右边距是固定的。尝试这个:

[newsfeed setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin];

正如其他人评论的那样,这在带有弹簧和支柱的 Interface Builder 中更容易完成:

在此处输入图像描述

于 2013-05-21T19:42:48.223 回答