jacob
jacob

Reputation: 541

Load different UITableViewCell when using storyboards

I have build my app based on story boards. I have made custom cell and set the class (PlayerCell) in the Identity Inspector. I now to set dynamically set a different cell - (ReplacementPlayerCell) - some teams have replacement player and some don't. How do I do that? Do I have to drop Storyboards and do it all programmatically?

Upvotes: 0

Views: 39

Answers (2)

Saurav Mac
Saurav Mac

Reputation: 82

Why don't you use UILabel in same player cell and set its text for only teams having there replacement player and for others hide that UILabel . In this way you have to use only one player cell only .

Upvotes: 0

Retro
Retro

Reputation: 4005

You can do this using identifier for cell like this

 if (indexPath.row == 0)
        {
            static NSString *cellId = @"tblBubbleHeaderCell";
            UIMessageHeaderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
            return cell;
        }

    // Standard bubble    
    static NSString *cellId = @"tblMessageCell";
    UIMessageTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];

Upvotes: 1

Related Questions