I have created table view and displayed the datas. I have used to different background image for the table view cell. I have displayed the datas are dynamically in the table view. I want to displayed the background image for the last table view cell which depends on the table view frame height, please see my image,
.Here my sample code,
if 开发者_运维技巧([indexPath row]%2) {
cell.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"cellbg1.png"]];
}else{
cell.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"cellbg2.png"]];
}
cell.backgroundView.contentMode = UIViewContentModeScaleToFill;
cell.backgroundView.alpha = 0.5;
So how can i fill the background image for the last cell which depends on the table view frame. And is any possible to find the table view height of displaying the contents of the data in table only. Please guide me.
Thanks.
Are you looking for table.bounds.size.height
? That would be the height of the viewable area of the table.
Or are you looking for the total height of the content in the table? Then you can use table.contentSize.height
.
Rather than setting the background of the last cell, you may want to use
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
method and set a footer view for the table.
精彩评论