iOS 8:一、tableView右滑显示选择
发布日期:2021-05-11 01:27:44 浏览次数:10 分类:精选文章

本文共 4744 字,大约阅读时间需要 15 分钟。

UITableViewRowAction���������������UITableView������������������������

���iOS������������UITableView������������������������������������������������������������������������������iOS 8���������������������������������������������API������������������������������������������UITableViewRowAction������������������������������������������UITableViewRowAction���������������������������UITableView���������������������������������forcing������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������ UITableViewRowAction ������������������������������������������������

1. ���������������������������editActionForRowAtIndexPath ������

���iOS 8���������������������UITableView ��������������������������������������� - tableView:editActionsForRowAtIndexPath:���������������������������������������������������������������������������������������������������������UITableViewRowAction������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

2. ������������������������������������

UITableViewRowAction ������������������������������

  • UITableViewRowActionStyleDestructive������������������������������������������������������������������
  • UITableViewRowActionStyleNormal���������������������������
  • UITableViewRowActionStyleDefault���������������������������������

������������������������������������������������������������UITableViewRowAction���������������������������������������������������������������������������������������������������������

UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"������" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {    // ������������������    NSLog(@"���������������");}];deleteRowAction.backgroundColor = [UIColor redColor];deleteRowAction.backgroundEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyle Dark];

3. ������������������������

���editActionForRowAtIndexPath������������������������������������������������indexPath.row���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������

Duty���� s��rie���- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {    NSArray *editActions = [NSArray new];    UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"������" handler:^{        NSLog(@"������������������������");    }];        UITableViewRowAction *editAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"������" handler:^{        NSLog(@"������������������������");    }];        UITableViewRowAction *shareAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title=@"������" handler:^{        NSLog(@"������������������������");    }];        editActions = [deleteAction, editAction, shareAction];        if (indexPath.row == 0) { // ������������������        // ������������������������    }    return editActions;}

������������������������������������������������������������UITableView���������������������������������������������������������

���������������������iOS���������������������������������������������������������������������������������������������������������������������������������

4. ������������

���������UITableViewRowAction������������������������������

  • ������������������editActions���������������������������������������������������������������������������������������������������������������������������������������������������������������������������

  • ������������������������������������������������������������������������editActions������������������������������������������������������������������������������������������������������������

  • ���������������������������������������������������������������������������������title���������������������������������

������

������UITableViewRowAction���������������������������TableView������������������������������������������������������������������������������������������������������������������������editActionsForRowAtIndexPath���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

上一篇:键盘遮挡输入框的问题
下一篇:iOS常用的一些类库

发表评论

最新留言

感谢大佬
[***.8.128.20]2025年04月22日 19时18分55秒