在iOS 11上出现scrollview布局往下偏移问题
程序员文章站
2022-08-04 15:47:09
在ios 11上出现scrollview布局往下偏移问题
//
// viewcontroller.m
//
#import "viewcontroller.h"...
在ios 11上出现scrollview布局往下偏移问题
// // viewcontroller.m // #import "viewcontroller.h" @interface viewcontroller () @property (nonatomic,strong)uiscrollview * scrollview; @end @implementation viewcontroller - (uiscrollview *)scrollview { if (!_scrollview) { _scrollview = [[uiscrollview alloc] init]; _scrollview.frame = cgrectmake(0, 0, 300, 300); } return _scrollview; } - (void)viewdidload { self.scrollview.backgroundcolor = [uicolor graycolor]; [self.view addsubview:self.scrollview]; //??=============判断系统版本 if (@available(ios 11.0, *)) { self.scrollview.contentinsetadjustmentbehavior = uiscrollviewcontentinsetadjustmentnever; nslog(@"11.0f"); } else { self.automaticallyadjustsscrollviewinsets = no; nslog(@"10f"); } } @end