Scrollview有几个主要的属性:
contentSize:Scrollview中内容视图的大小,返回CGSize结构体类型,包含width和height2个成员;
contentInset:用于在Scrollview中的内容视图周围添加边框,往往是为了留出空白以放置工具栏 标签栏 或导航栏
contentOffset:内容视图坐标原点雨Scrollview坐标原点的偏移量,返回CGSize结构体类型
@implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.scrollView.contentSize = CGSizeMake(320, 600); } -(void)viewDidAppear:(BOOL)animated { [self.scrollView setContentOffset:CGPointMake(0, 110) animated:YES]; //self.scrollView.contentOffset = CGPointMake(0, 110); NSLog(@" self.scrollView.contentSize %f,%f", self.scrollView.contentSize.height, self.scrollView.contentSize.width); [super viewDidAppear:YES]; }
时间: 2024-10-05 15:30:07