Setting style of UITableViewCell when using iOS 6 UITableView dequeueReusableCellWithIdentifier:forIndexPath:

后端 未结 6 1809
庸人自扰
庸人自扰 2020-12-02 07:28

I\'m trying to work out how to set the UITableViewCellStyle when using the new methods in iOS 6 for UITableView.

Previously, when creating

6条回答
  •  佛祖请我去吃肉
    2020-12-02 07:49

    Another alternative that saves one file is to create a Nib and use registerNib:forCellReuseIdentifier: instead.

    Making the Nib is easy: Create a new .xib file in Interface Builder. Delete the default view. Add a Table View Cell object. Using the Attributes Inspector, change the style for the cell. (Here you also have the opportunity to customize the cell further by adjusting other attributes.)

    Then in your table view controller's viewDidLoad method call something like:

    [self.tableView registerNib:[UINib nibWithNibName:@"StyleSubtitleTableCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"Cell"];
    

提交回复
热议问题