Programmatically adding a UITableView - how do I set the reuse identifier for the cells?
Use the method initWithStyle:reuseIdentifier
- check if
cell
exists - If it doesn't, then you need to initialize it.
code
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath (NSIndexPath*)indexPath
{
static NSString *cellIdentifier = @"wot";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
if (!cell)
cell = [[UITableViewCell alloc] initWithStyle: someStyle reuseIdentifier: cellIdentifier];
return cell;
}