Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIView layoutMargins in Interface Builder

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?

like image 969
Artem Abramov Avatar asked Dec 06 '14 12:12

Artem Abramov


1 Answers

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

like image 159
malhal Avatar answered Sep 25 '22 02:09

malhal