再会,
我的问题如下:我有一个滚动视图,我向它们添加了多个窗口。他们之间是一个小的空白空间。当我滚动图像时,图像会移动,但它们的“副本”会留在背景上。如果我没有图像之间的空白,您将看不到它,但是用颜色填充它不是解决方案,因为主视图具有应该通过间隙可见的背景图像。
有人知道吗?
代码:
lookbookScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0f, 490.0f, 768.0f, 375.0f)];
[lookbookScroll setScrollEnabled:YES];
[lookbookScroll setContentSize:CGSizeMake(([books count] * 275) + 20, 375)];
[self.view addSubview:lookbookScroll];
for (int i = 0; i < [books count]; i++)
{
UIButton *tmpButton = [UIButton buttonWithType:UIButtonTypeCustom];
[tmpButton setFrame:CGRectMake((i * 275) + 20, 0, 265, 375)];
[tmpButton setBackgroundColor:[UIColor blackColor]];
[tmpButton setBackgroundImage:[[books objectAtIndex:i] valueForKey:@"Image"] forState:UIControlStateNormal];
[tmpButton setTag:[[books objectAtIndex:i] valueForKey:@"Id"]];
[tmpButton addTarget:self action:@selector(readBook:) forControlEvents:UIControlEventTouchUpInside];
[lookbookScroll addSubview:tmpButton];
}