I would like to create a custom subclass of UITableViewCell that loads content asynchronously using a URL connection. I have a subclass of UITableViewCell that handles all this and a Nib file that defines the layout of the cell, but I am having trouble linking the two. Here is the code I use in tableView:cellForRowAtIndexPath:
static NSString *FavCellIdentifier = @"FavCellIdentifier";
FavouriteCell *cell = [tableView dequeueReusableCellWithIdentifier:FavCellIdentifier];
if (cell == nil)
{
cell = [[[FavouriteCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:FavCellIdentifier] autorelease];
}
cell.requestURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@?%@=%i", URL_GET_POST_STATUS,
URL_PARAM_SERIAL,
[[self.favourites objectAtIndex:indexPath.row] intValue]]];
return cell;
This gives the request URL to a subclass of UITableViewCell that handles the loading in the method setRequestURL.
In the FavoriteCell class, I saved the method initWithStyle:reuseIdentifier:as is, and in Nib, I set FavCellIdentifier as the identifier, and FavoriteCell as the class. Now, how to get the FavoriteCell class to load Nib?
source