Я пытаюсь переопределить метод setFrame
UITableViewCell
внутри класса, который наследует от UITableViewController
. Я нашел этот метод переопределенным как ответ this question, но я не знаю, как реализовать переопределение, чтобы заставить его работать.Метод переопределения объекта Object
Вот переопределение я хочу реализовать:
- (void)setFrame:(CGRect)frame {
int inset = 1;
frame.origin.x += inset;
frame.size.width -= 2 * inset;
[super setFrame:frame];
}
Это класс я хочу использовать переопределение:
@interface PeopleTableViewController : UITableViewController
{
}
@end
previous answer говорит подкласс UITableViewCell
переопределить метод. Как и где я это делаю? Заранее спасибо
EDIT: Здесь используется UITableViewCell
.
- (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;
}
Почему вы хотите переопределить его в контроллере? – Wain
Вы переопределите метод класса, написав подкласс класса THAT, а не какой-либо другой класс. –