Programmatically adding a UITableView - how do I set the reuse identifier for the cells?

Use the method initWithStyle:reuseIdentifier

  1. check if cell exists
  2. 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;
}