1

Interface Builder中,您有约束告诉应用程序如何在设备旋转时重新绘制屏幕。

有没有办法以编程方式设置这些?

4

1 回答 1

3

您需要设置autoresizingMask视图。

它指定视图如何自动调整大小。(这是您在 中设置的Interface Builder。)

enum {
   UIViewAutoresizingNone                 = 0,
   UIViewAutoresizingFlexibleLeftMargin   = 1 << 0,
   UIViewAutoresizingFlexibleWidth        = 1 << 1,
   UIViewAutoresizingFlexibleRightMargin  = 1 << 2,
   UIViewAutoresizingFlexibleTopMargin    = 1 << 3,
   UIViewAutoresizingFlexibleHeight       = 1 << 4,
   UIViewAutoresizingFlexibleBottomMargin = 1 << 5
};
typedef NSUInteger UIViewAutoresizing;
于 2012-07-04T04:10:46.980 回答