goku
goku

Reputation: 169

how to customise UITableView?

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.like this page I am trying to make my application![][1]

Upvotes: 0

Views: 143

Answers (2)

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

when configuring your UITableViewCellyou 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

Related Questions