Reputation: 169
How to add image and texts as shown in the below snapshots?I am already using navigation controller in my application, so is there any problem in including UITableView controller as a new navigated page from home page.
Upvotes: 0
Views: 143
Reputation: 966
I would subclass the UITableView Cell and create my own cell MyCustomTableViewCell
, with the UIImageView and UILabel inside.
Then you could do this to update your cells in reusing case
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]
MyCustomTableViewCell *myCell = (MyCustomTableViewCell)cell;
myCell.label.text = newText;
myCell.imageView.image = newImage;
return cell;
}
Upvotes: 0
Reputation: 966
when configuring your UITableViewCell
you can add a UIImageView
and UILabel
to the cells contentView
.
UITableViewCell *cell = ...;
UIImageView *yourImageView = ...;
UILabel *yourLabel = ...;
[cell.contentView addSubview:yourImageView];
[cell.contentView addSubview:yourLabel];
Upvotes: 2