【发布时间】:2013-03-14 15:15:39
【问题描述】:
我有一个 scrollView,我需要它自己非常缓慢地向下滚动到最后,当用户触摸视图时,它应该响应手势(向上向下)。除此之外,我需要放置一个停止/播放自动滚动的按钮。
代码:
self.scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
self.scrollView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
self.scrollView.contentSize = CGSizeMake(320,4750);
_scrollView.frame = CGRectMake(0, 44, 320, 420);
UIButton *camilaButton = [UIButton buttonWithType:UIButtonTypeCustom];
[camilaButton setImage:[UIImage imageNamed:@"camila.jpg"] forState:UIControlStateNormal];
[camilaButton setImage:[UIImage imageNamed:@"camila.jpg"] forState:UIControlStateHighlighted];
camilaButton.frame = CGRectMake(20, 10, 280, 200);
[self.scrollView addSubview:camilaButton];
[camilaButton addTarget:self action:@selector(onButtonPressCamila) forControlEvents:UIControlEventTouchUpInside];
UILabel *camilaLabel = [[UILabel alloc] initWithFrame:CGRectMake(40,220,100,30)];
camilaLabel.text = @"Camila";
[self.scrollView addSubview:camilaLabel];
...然后在滚动视图的末尾有类似的带有图像的按钮。
我该怎么做?
米海
【问题讨论】:
标签: xcode button scroll playback autoscroll