Bruno Leite
Bruno Leite

Reputation: 1477

UITableViewCellStyle

I would like to create a table like the iPhone (calls) which are displayed three labels.

UITableViewCellStyleSubTitle displays only two options as well as UITableViewCellStyleSubValue1.

Do I have to manually create it?

Thanks.

/ / English Google

Upvotes: 1

Views: 2994

Answers (3)

Warre Buysse
Warre Buysse

Reputation: 1345

As Peter DeWeese was saying you have to make a custom UITableViewCell. Let me point out that since iOS 6 this is the only correct way to do it.

  1. Make a subclass UITableViewCell.
  2. In the initializer (.m file) you can rewrite the style that is given when the super class is called.

code example:

  • (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:--------UITableViewCellStyleSubtitle------- reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code } return self; }

    1. Go to your TableViewController and registrate that cell in the viewDidLoad method.

    [self.tableView registerClass:[---------FriendCell---------- class] forCellReuseIdentifier:@"vriendCel"];

//And if someone would help me out to put my code properly, can't seem to fix it. :)

Upvotes: 0

Peter DeWeese
Peter DeWeese

Reputation: 18343

A third place to put something is the accessoryView, which shows up to the right of the cell.

The best way to have full control over a cell is to make a custom UITableViewCell. An example.

Upvotes: 1

Josh Sherick
Josh Sherick

Reputation: 2161

Yes, you have to manually create it. Watch this YouTube video for a tutorial.

Also, next time you ask a question, provide a more descriptive title, and you will likely get more views and answers.

Upvotes: 0

Related Questions