質問

My question may appear strange, but with an example it's easier to understand :

I have, let's say an UIButton, that I create and then :

// [...] Create button, add it to view
myButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;

If I don't specify UIViewAutoresizingFlexibleRightMargin, my component will not be at the right x-ratio on the screen. Why ? I specified left margin, so my element should be at the good position when I rotate the device... Don't understand the need of the right margin.

役に立ちましたか?

解決

When you use both flexible margins, a change in width will be split between the two margins. This is commonly used to keep a view centered.

When you use just one flexible margin, a change in width will all be applied to the one flexible margin. This means the other margin stays the same, no matter how the width changes.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top