//
// 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
iOS 11 中scrollview布局往下偏移问题automaticallyAdjustsScrollViewInsets、contentInsetAdjustmentBehavior(iOS 11
最新推荐文章于 2019-07-10 18:33:48 发布