Mixed usage of Auto Layout with non-Auto Layout

Mr.Javed Multani
1 min readOct 3, 2020

Sometimes you may want to perform some additional actions to Auto Layout calculations done by UIKit itself. Example: when you have a UIView that has a maskLayer, you may need to update maskLayer as soon as Auto

Layout changes UIView’s frame

// CustomView.m- (void)layoutSubviews {
[super layoutSubviews];
// now you can assume Auto Layout did its job
// you can use view's frame in your calculations
CALayer maskLayer = self.maskLayer;
maskLayer.bounds = self.bounds;
...
}

--

--

Mr.Javed Multani

Software Engineer | Certified ScrumMaster® (CSM) | UX Researcher | Youtuber | Tech Writer