I have to set autoresizingMask programmatically for UIView
.
I don\'t know how to implement this.
You have to set the view's autoresizingMask
property:
view.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
The possible values are defined in UIViewAutoresizing
:
enum {
UIViewAutoresizingNone = 0,
UIViewAutoresizingFlexibleLeftMargin = 1 << 0,
UIViewAutoresizingFlexibleWidth = 1 << 1,
UIViewAutoresizingFlexibleRightMargin = 1 << 2,
UIViewAutoresizingFlexibleTopMargin = 1 << 3,
UIViewAutoresizingFlexibleHeight = 1 << 4,
UIViewAutoresizingFlexibleBottomMargin = 1 << 5
};
typedef NSUInteger UIViewAutoresizing;
You can set multiple values with the bitwise OR operator |
.