iOS8左滑出現三個按鈕

// 自動進入編輯模式,出現左滑效果
- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // 回調方法里寫點擊事件
    UITableViewRowAction *rowAction = [UITableViewRowAction rowActionWithStyle:(UITableViewRowActionStyleNormal) title:@"樂呵拉赫" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
        NSLog(@"xixi");
    }];

    UITableViewRowAction *rowAction2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"樂呵你妹" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
        NSLog(@"doubi");
    }];

    UITableViewRowAction *rowAction3 = [UITableViewRowAction rowActionWithStyle:(UITableViewRowActionStyleDefault) title:@"刪除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
        NSLog(@"刪了");
    }];
    UITableViewRowAction *rowAction4 = [UITableViewRowAction rowActionWithStyle:(UITableViewRowActionStyleDestructive) title:@"111" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
        NSLog(@"222");
    }];
    rowAction.backgroundColor = [UIColor redColor];
    rowAction2.backgroundColor = [UIColor greenColor];
    NSArray *array = @[rowAction,rowAction3,rowAction2,rowAction4];
    return array;
}
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容