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,701
  • 4
  • 27
  • 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
  • 9,188
  • 10
  • 67
  • 113
malhal
  • 26,330
  • 7
  • 115
  • 133