views:

92

answers:

1

dequeueReusableCellWithIdentifier: Returns a reusable table-view cell object located by its identifier.

  • (UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier

Parameters identifier A string identifying the cell object to be reused. By default, a reusable cell's identifier is its class name, but you can change it to any arbitrary value.

Ok so if by default it's the class name, why should I put much brain force into thinking about an identifier? Could I provide just nil? Would it then use the class name? Or what did they try to say here? Must I make an NSString with the class name by myself and provide it as identifier?

+1  A: 

No. The identifier will be used as a key in an internal NSMutableDictionary of NSArray to store the reusable cells. If you provide nil, the -objectForKey: used in -dequeueReusableCellWithIdentifier: will crash.

Besides, a table may have cells from different (sub)classes of UITableViewCell, so there's no good default value to pass either.

KennyTM
so if I would make an NSString from class name, would that be a solution?
dontWatchMyProfile
@mystify: Yes. But I tend to just give a dummy string e.g. `@"."` as an identifier.
KennyTM