UIViewController
with UIView
and UITableView
UIView
|-UITableView
I'm trying to setup margins like this:
- (void)viewDidLoad {
[super viewDidLoad];
self.view.layoutMargins = UIEdgeInsetsMake(30, 30, 30, 30);
self.tableView.preservesSuperviewLayoutMargins = YES;
[self.view layoutIfNeeded];
}
but nothing is happening on the view.
Here are the constraints from InterfaceBuilder
(lldb) po self.view.constraints
<__NSArrayM 0x786ab6e0>(
<NSLayoutConstraint:0x7896e940 UIView:0x7896e470.trailingMargin == UITableView:0x79b51a00.trailing - 16>,
<NSLayoutConstraint:0x7896e970 UITableView:0x79b51a00.leading == UIView:0x7896e470.leadingMargin - 16>,
<NSLayoutConstraint:0x7896e9a0 V:[_UILayoutGuide:0x7896e510]-(0)-[UITableView:0x79b51a00]>,
<NSLayoutConstraint:0x7896e9d0 V:[UITableView:0x79b51a00]-(0)-[_UILayoutGuide:0x7896e600]>,
<_UILayoutSupportConstraint:0x7896c7d0 V:[_UILayoutGuide:0x7896e510(0)]>,
<_UILayoutSupportConstraint:0x7896c2b0 V:|-(0)-[_UILayoutGuide:0x7896e510] (Names: '|':UIView:0x7896e470 )>,
<_UILayoutSupportConstraint:0x7896cbf0 V:[_UILayoutGuide:0x7896e600(0)]>,
<_UILayoutSupportConstraint:0x7896ea00 _UILayoutGuide:0x7896e600.bottom == UIView:0x7896e470.bottom>
)
as a result don't see any margins, nothing is changed at all.... What I'm issing ?
iOS 8
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…