Swift 3:UITableViewRowActionStyle()" Missing Parameter"错误消息 [英] Swift 3: UITableViewRowActionStyle() "Missing Parameter" Error Msg

查看:134
本文介绍了Swift 3:UITableViewRowActionStyle()" Missing Parameter"错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我滑动UITableView单元格时,会调用以下代码:

When I swipe a UITableView cell, the below code is called:

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {

    //Problem code
    let delBut = UITableViewRowAction(style: UITableViewRowActionStyle(), title: delete_InLocal) { action, index in
        //Setup

现在我已经开始迁移到Swift 3,我在UITableViewRowActionStyle()上收到一条错误消息:

Now that I've started migrating to Swift 3, I get an error message on the UITableViewRowActionStyle():


在调用中缺少参数'rawValue'的参数

Missing argument for parameter 'rawValue' in call

任何人知道Swift 3在这种情况下的语法是什么?

Anyone know what the syntax for Swift 3 is in this situation?

推荐答案

从Swift 3中的一些导入的枚举类型中删除了默认的初始值设定项。

Default initializers are removed from some imported enum types in Swift 3.

使用 UITableViewRowActionStyle.default (或者在你的情况下只需 .default )而不是 UITableViewRowActionStyle()

Use UITableViewRowActionStyle.default (or in your case simply .default) instead of UITableViewRowActionStyle().

    let delBut = UITableViewRowAction(style: .default, title: delete_InLocal) { action, index in

这篇关于Swift 3:UITableViewRowActionStyle()" Missing Parameter"错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆