如何使用Objective C在iOS7 UITableView中制作自定义编辑视图,如Evernote或Apple Reminders应用程序,同时向左滑动.我试图设置自定义editingAccessoryView,但这不起作用.
Evernote编辑视图:
提醒编辑视图:

我目前的代码是
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSLog(@"delete");
}
}
Run Code Online (Sandbox Code Playgroud)
我试图用以下方法解决问题:(UITableViewController.h)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//make cell
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
[view setBackgroundColor:[UIColor greenColor]];
//add Buttons to view
cell.editingAccessoryView = view;
return cell;
}
Run Code Online (Sandbox Code Playgroud)
与之相同:(UITableViewCell)
- (void)willTransitionToState:(UITableViewCellStateMask)state;
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
- (UIView*)editingAccessoryView;
Run Code Online (Sandbox Code Playgroud)