【发布时间】:2014-09-24 08:21:38
【问题描述】:
我有这一套:
UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 1000.0)];
scroll.backgroundColor = [UIColor clearColor];
scroll.contentSize = CGSizeMake(320.0, 1000.0);
[self.view addSubview:scroll];
UIView *pView = [[UIView alloc] initWithFrame:CGRectMake(10.0, 100.0, 300.0, 400.0)];
pView.backgroundColor = [UIColor whiteColor];
pView.layer.cornerRadius = 2.0;
pView.layer.borderColor = [UIColor blueColor].CGColor;
pView.layer.borderWidth = 1.0f;
[scroll addSubview:pView];
UIView *aView = [[UIView alloc] initWithFrame:CGRectMake(10.0, 500.0, 300.0, 20.0)];
aView.backgroundColor = [UIColor redColor];
[scroll addSubview:aView];
但每次我在视图上向下滚动时,屏幕都会弹回顶部。为什么?
【问题讨论】:
标签: ios ios7 uiview uiscrollview