- 创建UIScrollView对象并设置它的大小.
UIScrollView *scrollView;
self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0,w, h)];
- 设置代理
self.scrollView.delegate = self;
- 设置content的大小.
self.scrollView.contentSize = CGSizeMake(w, h);
- 设置是否可以滑动.
self.scrollView.pagingEnabled = YES;
- 添加到视图
[self.view addSubview:self.scrollView];
使用UIScrollView
最新推荐文章于 2021-08-20 16:33:48 发布