Właśnie natknąłem się na ten nowy interfejs API na iOS8. Nie mogę jednak znaleźć rozwiązania, jeśli można używać obrazów zamiast tekstu i zezwalać na przesuwanie w lewo i w prawo? Czy to możliwe? Jedynym realizacja Znalazłem to:iOS 8 UITableViewRowAction: Przesuń w lewo, obrazy?
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Button1" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
// maybe show an action sheet with more options
[self.tableView setEditing:NO];
}];
moreAction.backgroundColor = [UIColor blueColor];
UITableViewRowAction *moreAction2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Button2" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
[self.tableView setEditing:NO];
}];
moreAction2.backgroundColor = [UIColor blueColor];
UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}];
return @[deleteAction, moreAction, moreAction2];
}
Dziękuję panie :-) – MichiZH
Jest to świetna wskazówka, ale gdy próbuję go, pojawia się obraz kaflowy. mogę zbudować obraz dla rozmiaru rzędu, ale moje komórki mają zmienne wysokości. jeśli tak jest, czy jest jakiś sposób obejścia tego, czy powinienem po prostu użyć biblioteki innej firmy? – skinsfan00atg
Dla zdjęć, połączyłem CocoaPod, który spróbuje rozwiązać to tak elegancko, jak to możliwe na razie: https://github.com/benguild/BGTableViewRowActionWithImage –