ScrollView 分割屏幕效果
生活随笔
收集整理的這篇文章主要介紹了
ScrollView 分割屏幕效果
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 CGRect screentRect = self.view.bounds;
2 CGRect bigRect = screentRect;
3 bigRect.size.width *= 2.0;
4 // bigRect.size.height *= 2.0;
5
6 //創建一個UIScrollView對象,將其尺寸設置為窗口大小
7 UIScrollView *scrollView = [[UIScrollView alloc]initWithFrame:screentRect];
8 //分欄
9 [scrollView setPagingEnabled:YES];
10 [self.view addSubview:scrollView];
11
12 //創建一個有著超大尺寸的BNRHypnosisView 對象并將其加入UIScrollView對象
13 // BNRHypnosisView *hypnosisView = [[BNRHypnosisView alloc]initWithFrame:bigRect];
14 BNRHypnosisView *hypnosisView = [[BNRHypnosisView alloc]initWithFrame:screentRect];
15 [scrollView addSubview:hypnosisView];
16
17 //創建第二個大小與屏幕相同的BNRHypnosisView對象并放置在第一個BNRHypnosisView
18 //對象的右側,使其剛好移出屏幕外
19 screentRect.origin.x +=screentRect.size.width;
20 BNRHypnosisView *anotherView = [[BNRHypnosisView alloc]initWithFrame:screentRect];
21 [scrollView addSubview:anotherView];
22
23 //告訴UIScrollView對象"取景" 范圍有多大
24 scrollView.contentSize = bigRect.size;
?
轉載于:https://www.cnblogs.com/yanggenwei/p/5002973.html
總結
以上是生活随笔為你收集整理的ScrollView 分割屏幕效果的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python3.4 django使用my
- 下一篇: WebQQ hash加密算法PHP版