I\'m trying to work out how to set the UITableViewCellStyle
when using the new methods in iOS 6 for UITableView
.
Previously, when creating
My solution to this is to call initWithStyle: reuseIdentifier:
after I've obtained it using [self.tableView dequeueReusableCellWithIdentifier:@"cellId" forIndexPath:indexPath]
. After all, init
is just another selector, and the compiler makes no restrictions on calling it on an already initialised object. It will however complain about not using the result of calling init, so I do:
UITableViewCell* cell = [self.tableView dequeueReusableCellWithIdentifier:@"cellId" forIndexPath:indexPath];
cell = [cell initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cellId"];
I imagine this won't work in Swift...