简体   繁体   中英

IOS 9 view are being cut in the bottom

Views are being cut in the bottom even if there is constraint for like 22 but as you can see in the picture below it's just like 2 or 3. The constraint is perfectly fine in ios 7 and ios 8(not really sure in ios 8) and this only happens in ios 9. I log the height of self.view(frame and bounds) and for iphone 5 I got 568 for both frame and bounds. How is this happening? And how can I fix this?

在此处输入图片说明

Here is the screen capture for ios8

在此处输入图片说明

When drag any control on any controller on storyboard it will be alloc and init and you can get its actual frame using initWithCoder that will be called before you init on viewDidLoad method there to find the actual frame of your control you can manage it using this method. Here is the method where you can adjust your control's frame :

- (id)initWithCoder:(NSCoder *)aDecoder {
    if ((self = [super initWithCoder:aDecoder])) {
        [self setActualFramewithinInitialization];
    }
    return self;
}
- (void)setActualFramewithinInitialization {

    //you can adjust the frame of your control with initializations   as you need    
}

This method is useful when you set your control's frame using storyboard or nib and you didn't get it right at the end.

You have to initialize you Control here because this method will call before initialization of your View .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM