I am trying to override the setFrame
method of UITableViewCell
inside of a class that inherits from UITableViewController
. I found this method override as an answer to this question but I don't know how to implement the override to get it to work.
Here is the override I want to implement:
- (void)setFrame:(CGRect)frame {
int inset = 1;
frame.origin.x += inset;
frame.size.width -= 2 * inset;
[super setFrame:frame];
}
This is the class I want to use the override in:
@interface PeopleTableViewController : UITableViewController
{
}
@end
The previous answer says to subclass UITableViewCell
to override the method. How and where do I do this? Thanks in advance
EDIT: This is where the UITableViewCell
is used.
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
}
// Configure the cell...
//USE TO SET CELL IMAAGE BACKGROUND
cell.backgroundView = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"basketball.png"]
stretchableImageWithLeftCapWidth:0.0
topCapHeight:5.0]];
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"basketball.png"]
stretchableImageWithLeftCapWidth:0.0
topCapHeight:5.0]];
[cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton];
return cell;
}