Since ios 8.0 views have additional layoutMargins
which by default has an 8 points values for every side.
When I try to change margins in viewDidL
I used KVO to detect the view.layoutMargins changes. And I found that the view itself would change the layoutMargins after customise during layoutSubViews
processing.
So just put your customise codes in viewDidLayoutSubviews
method:
- (void)viewDidLayoutSubviews
{
self.view.layoutMargins = UIEdgeInsetsMake(100.0f, 100.0f, 100.0f, 100.0f);
}
PS: Through these codes are OC, but I think it can also work for Swift. Hope this works for you!