uiview - Position of Nib-loaded Subview incorrect in iOS 8 -
I have a custom class called CNJobMapView which is the subclass of UIView. This custom class loads one view from a nib file and adds it as a subview, so I do this so that I can add a UIView object to a view in the storyboard, give it a CNzab mapview custom class, and when I If you run the app then it will appear in that scene.
I accept CNJobMapView's awakeFromNib method, such as:
- (zero) awakeFromNib {[NSBundle mainBundle] loadNibNamed: @ "CNJobMapView" owner: self choice: zero]; [Self add sbewview: self Content view]; [Self interval setup]; }
In this case, the self.contentView is the main view in the nib named "CNJobMapView" It is connected to IB.
In iOS 7 and 7.1, it all works properly. It looks like:
In iOS 8, this is true ContentView does not work correctly appears in the wrong position. Such as:
I do not know why it is different IOS In 8 I will find some help in detecting this problem!
I got the answer!
Apparently in iOS 7, it considers the right odds to keep contentView inside CNJobMapView. In iOS 8, this is no longer the case. I have modified the phenlb function in awareness as follows:
- (zero) awakeFromNib {[NSBundle mainBundle] loadNib nominated: @ "CNJobMapView" owner: self choice: zero]; [Self add sbewview: self Content view]; [Self interval setup]; NSDictionary * Visual = NSDictionaryOfVariableBindings (contentView); NSERE * Horizon Resource Consultants = [Visual Format with NSLut Constant Hurdles: @ "H: | [Content View] |" Option: 0 metric: zero view: view]; [To add itself: Horizon conference]; NSArray * vertContentConstraints = [NSLayoutConstraint Visual Formats with Obstacles: @ "V: | [contentView] |" | Option: 0 metric: zero view: view]; [To add self: vertContentConstraints]; }
And the problem is fixed now.
Comments
Post a Comment