Я использую проект GitHub под названием SWTableViewCell. Тем не менее, я постоянно получаю эту ошибку: No visible @interface for 'NSMutableArray' declares the selector 'addUtilityButtonWithColor:icon:'
.Нет видимого @interface для 'NSMutableArray' объявляет селектор 'addUtilityButtonWithColor: icon:'
Пострадавшая код здесь:
- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellId = @"Cell";
SWTableViewCell *cell = (SWTableViewCell *)[table dequeueReusableCellWithIdentifier:cellId];
if (cell == nil) {
NSMutableArray *leftUtilityButtons = [NSMutableArray new];
NSMutableArray *rightUtilityButtons = [NSMutableArray new];
[leftUtilityButtons addUtilityButtonWithColor:
[UIColor colorWithRed:0.00 green:0.4 blue:225 alpha:1.0]
icon:[UIImage imageNamed:@"check.png"]];
[leftUtilityButtons addUtilityButtonWithColor:
[UIColor colorWithRed:0.0 green:0.5 blue:225 alpha:1.0]
icon:[UIImage imageNamed:@"clock.png"]];
[leftUtilityButtons addUtilityButtonWithColor:
[UIColor colorWithRed:0.0 green:0.6 blue:225 alpha:1.0]
icon:[UIImage imageNamed:@"cross.png"]];
[leftUtilityButtons addUtilityButtonWithColor:
[UIColor colorWithRed:0.0 green:0.7 blue:225 alpha:1.0]
icon:[UIImage imageNamed:@"list.png"]];
[rightUtilityButtons addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:0.231f blue:0.188 alpha:1.0f]
title:@"Delete"];
cell = [[SWTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:cellId
containingTableView:table // For row height and selection
leftUtilityButtons:leftUtilityButtons
rightUtilityButtons:rightUtilityButtons];
cell.delegate = self;
cell.textLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:18];
cell.detailTextLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:13];
}
// Configure cell
// Sets the text for the cell
cell.textLabel.text = [NSString stringWithFormat:@"Testing"];
cell.detailTextLabel.text = [NSString stringWithFormat:@"This is a test."];
return cell;
}
Почему это не работает? Заранее спасибо.
Я думаю, вы должны иметь категорию по NSMutableArray, которые содержат метод: 'addUtilityButtonWithColor: значок:'. – Greg
В соответствии с примером в [GitHub] (https://github.com/CEWendel/SWTableViewCell) имя метода - 'sw_addUtilityButtonWithColor'. – Rob
Вы потеряли категорию NSMutableArray + SWUtilityButtons http://ios-blog.co.uk/tutorials/swtableviewcell-expose-utility-buttons-with-an-easy-to-use-uitableviewcell-subclass/ –