CKT*_*CKT 2 iphone uiscrollview uiscrollviewdelegate ipad ios
我UIScrollView在我的应用程序中使用了一个,我的要求是我必须添加背景颜色,UIScrollView但是当用户拖动到极端顶部或最底部时,除了内容/外部区域之外,滚动视图中显示的内容应该用不同的颜色显示UIWebView.在网页视图中,如果我们在顶部向下拖动或在底部向上拖动它将显示默认背景图像/灰色颜色,并且Web视图内容背景颜色为diff(默认为白色).任何人都可以帮助我实现此目的.
谢谢.
诀窍是将子视图添加到位于内容上方和下方的ScrollView.这样,它们仅在向上或向下拖动内容时出现.
UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(0, -200, scroll.bounds.size.width, 200)];
[topView setBackgroundColor:[UIColor darkGrayColor]];
[scroll addSubview:topView];
[topView release];
UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, scroll.bounds.size.height, scroll.bounds.size.width, 200)];
[bottomView setBackgroundColor:[UIColor darkGrayColor]];
[scroll addSubview:bottomView];
[bottomView release];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7677 次 |
| 最近记录: |