我正在尝试在表格视图单元格中创建一个简单的滚动视图。就像在应用商店中一样,但滚动更简单。
滚动视图正在显示,但它根本不滚动。我已经在谷歌上尝试了整个第一页和许多 stackoverflow 问题,似乎找不到我做错了什么。
if (indexPath.row==0) {
// Clearing out cell background
[cell setBackgroundColor:[UIColor clearColor]];
[cell.contentView setBackgroundColor:[UIColor clearColor]];
// Imageviews for scrollview
UIImageView *imageview1 = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,123)];
UIImageView *imageview2 = [[UIImageView alloc] initWithFrame:CGRectMake(320,0,320,123)];
imageview1.image = [UIImage imageNamed:@"flash2.png"];
imageview2.image = [UIImage imageNamed:@"IMG_2458.JPG"];
// setting up scrollview
self.scrollViewHeader = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,320, 123)];
self.scrollViewHeader.scrollEnabled = YES;
self.scrollViewHeader.delegate = self;
[self.scrollViewHeader setUserInteractionEnabled:YES];
[self.scrollViewHeader setContentSize:CGSizeMake(320, 123)];
[self.scrollViewHeader addSubview:imageview1];
[self.scrollViewHeader addSubview:imageview2];
[cell.contentView addSubview:self.scrollViewHeader];
}
else{
// Normal table cells.
...
}
提前感谢您的回答。