當時沒想出解決的方法。
今天看到下面這篇文章, 覺得這方式也不錯,或許是個方式,這邊記錄一下。
有機會再來試一下。
http://www.appcoda.com/ios-programming-customize-uitableview-storyboard
- (UIImage *)cellBackgroundForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger rowCount = [self tableView:[self tableView] numberOfRowsInSection:0];
NSInteger rowIndex = indexPath.row;
UIImage *background = nil;
if (rowIndex == 0) {
background = [UIImage imageNamed:@"cell_top.png"];
} else if (rowIndex == rowCount - 1) {
background = [UIImage imageNamed:@"cell_bottom.png"];
} else {
background = [UIImage imageNamed:@"cell_middle.png"];
}
return background;
}
沒有留言:
張貼留言