How to set UITableViewCell Identifier in Xcode 4

2019-02-24 11:59发布

问题:

In Xcode 4, I failed to find where to set UITableViewCell's Identifier, can anybody helps me? Thank you very much.

回答1:

In code:

myTableViewCell.reuseIdentifier = @"CustomIdentifier";

In the interface design document (right-click and view image to get a bigger picture):

  1. Go to the leftmost tab here, the Project navigator.
  2. Select the .xib file containing your cell design.
  3. Select the UITableViewCell object within the .xib
  4. Make sure the rightmost "View" is showing and then go to the 4th-from-left tab, the Attributes inspector.
  5. The top box labelled "Identifier" is where you enter your identifier.


回答2:

When you create a new UITableViewCell in an interface document, select it, show Utilities by pressing Cmd+Opt+0. Under the "Attributes" inspector the first object is your identifier.



回答3:

You can use the attribute named 'tag', type of NSInteger