0
我需要创建一个滚动的水平列表,该列表是由10张图像,屏幕只适合1和这些图像的一半,因此当用户滚动我需要设置在屏幕中央显示图像,并且还显示正面图像和后向图像上的一部分。到目前为止,我有什么是这样的:UIScrollView的自定义水平滚动
scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 150, 1024, 520)];
scroll.delegate = self;
scroll.pagingEnabled = NO;
int numberOfViews = 10;
float xOrigin = 0;
for (int i = 0; i < numberOfViews; i++) {
xOrigin = i * 600;
FigureImage *tape = [[FigureImage alloc] initCustom];
[scroll addSubview:tape];
FigureImage *pictureFigure = [[FigureImage alloc] initCustom];
[scroll addSubview:pictureFigure];
}
scroll.contentSize = CGSizeMake(numberOfViews*10, 500);
pageWidth = (numberOfViews*10)/numberOfViews;
[self.view addSubview:scroll];
有了这个代码,我能够滚动的图像,但在任何特定的图像滚动犯规停止,我怎么能在最后x位置停止滚动?
好了,我怎么能停止我想要的视图中的滚动? –
从您通过的点开始,找出将视点居中并将该点传回的最近点。 – hatfinch