//
// 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
最新推荐文章于 2025-06-30 14:00:33 发布
本文介绍了一个在iOS 11及以上版本中调整UIScrollView内容偏移行为的示例,并提供了向下兼容旧版本的方法。通过使用@available检查当前系统版本来决定是否应用新的contentInsetAdjustmentBehavior属性。
部署运行你感兴趣的模型镜像
您可能感兴趣的与本文相关的镜像
ACE-Step
音乐合成
ACE-Step
ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言
1424

被折叠的 条评论
为什么被折叠?



