iPhone- how to use Storyboard with custom UITableView cells and CellWithIdentifier

前端 未结 4 1646
执笔经年
执笔经年 2021-02-02 16:53

I\'m trying to make use of the new Storyboard designer and the ease of drawing UITableView cells instead of programmatically \"designing\" each row.

A good example of a

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-02 17:26

    For each new custom UITableViewCell that you create in storyboard, you will want to create a new class file which implements UITableViewCell to link it to. Be sure to map all of the controls within your new cell that you laid out in storyboard to instance properties. Then you'll just use it with dequeuing like normal:

    YourTableViewCellClass *cell = (YourTableViewCellClass*)[tableView dequeueReusableCellWithIdentifier:@"YourCellIdentifierStringDefinedInStoryBoard"];
    // then set the properties for the class.
    cell.labelTime = @"whatever";
    

提交回复
热议问题