8

There is a new property of UIView: layoutMargin in iOS8.

In order to set the margins of a view programmatically:

self.view.layoutMargins = UIEdgeInsetsMake(0, 0, 10, 10);

Is it possible to set margins in Interface Builder?

Artem Abramov
  • 4,646
  • 4
  • 25
  • 38

1 Answers1

5

This can be achieved by setting a User Defined Runtime Attribute in the Identity Inspector:

screenshot 1

Although Xcode does have a margins setting, as of 7.3 (7D175), it still doesn't have any effect, so you have to use the user defined attribute:

screenshot 2

Iulian Onofrei
  • 8,409
  • 9
  • 67
  • 106
malhal
  • 20,618
  • 6
  • 104
  • 120