Hey,
What's the correct way to go about customizing a UITableViewCell in IB and hooking it up to a UITableViewController?
I tried:
1. Created XIB with File's Owner as myTableViewController and UITableView component.
2. Created the myTableViewController UITableViewController subclass and hooked up the UITableView.
3. Added a UITableViewCell to the XIB and gave it the class name of a UITableViewCell subclass I made.
4. Set the UITableViewCell reuse identifier and customized it with an image and what not.
myTableViewController creates the cells like so:
I'm not sure why this doesn't work? I guess it could be because the cell initializes using alloc/init - does it need to initialize from the XIB somehow? The text "test" appears in the cell but none of the customizations I made in IB...
Thanks for your time,
-Ross
What's the correct way to go about customizing a UITableViewCell in IB and hooking it up to a UITableViewController?
I tried:
1. Created XIB with File's Owner as myTableViewController and UITableView component.
2. Created the myTableViewController UITableViewController subclass and hooked up the UITableView.
3. Added a UITableViewCell to the XIB and gave it the class name of a UITableViewCell subclass I made.
4. Set the UITableViewCell reuse identifier and customized it with an image and what not.
myTableViewController creates the cells like so:
Code:
-( UITableViewCell * )tableView:( UITableView * )tableView cellForRowAtIndexPath:( NSIndexPath * )indexPath
{
static NSString *identity = @"MyCustomCell";
MyCustomCell *cell = ( MyCustomCell * )[tableView dequeueReusableCellWithIdentifier:identity];
if( cell == nil )
{
cell = [[[MyCustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:identity] autorelease];
}
cell.text = @"test";
return cell;
}
I'm not sure why this doesn't work? I guess it could be because the cell initializes using alloc/init - does it need to initialize from the XIB somehow? The text "test" appears in the cell but none of the customizations I made in IB...
Thanks for your time,
-Ross