昨天在折腾UITableView,最终想实现的效果是在UITableViewCell里添加UIScrollView,
效果图如下:
初步设计是用代码生成UITableView,所以没有用到IB来创建View等控件。
几经波折,在自定义TableViewCell里成功添加了UIScrollView,而scrollview里面动态添加了N张远程图片。
但是Cell的高度始终都是原始的44像素,由于Cell里面的图片都是有固定大小,所以在
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 128.0;
}
self.PhotoDetailTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, screenFrame.size.width, screenFrame.size.height-93) style:UITableViewStylePlain];
self.PhotoDetailTable.dataSource = self;
self.PhotoDetailTable.delegate = self;
OK,运行后,Cell高度正常显示为128