首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UITableViewRowAction -保留单元格的文本

UITableViewRowAction -保留单元格的文本
EN

Stack Overflow用户
提问于 2017-10-24 10:06:55
回答 1查看 173关注 0票数 0

使用UITableViewRowAction是很棒的。有一件事困扰着我,我想保留一部分原始的单元格textLabel,这样我亲爱的用户就会知道他们正在删除什么。

通过使用UITableViewRowAction,它将单元格标签从屏幕上推开(参见“我的文本?”绿色的)

有办法绕过这件事吗?

代码语言:javascript
复制
 func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {

        let editAction = UITableViewRowAction(style: .destructive, title: "Edit") { (rowAction, indexPath) in
            //TODO: edit the row at indexPath here
        }
        editAction.backgroundColor = .gray

        let deleteAction = UITableViewRowAction(style: .normal, title: "Delete") { (rowAction, indexPath) in
            //TODO: Delete the row at indexPath here
        }
        deleteAction.backgroundColor = .red

        let sendAction = UITableViewRowAction(style: .normal, title: "More") { (rowAction, indexPath) in
            //TODO: Delete the row at indexPath here
        }
        sendAction.backgroundColor = .darkGray

        return [deleteAction,editAction,sendAction]
    }
EN

回答 1

Stack Overflow用户

发布于 2017-10-24 15:04:30

如果您希望您的labelText保持原样,则必须添加一个删除按钮,因为您不能更改此按钮。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46907700

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档