【问题标题】:crash using ACEAutocompleteBar in swift:快速使用 ACEAutocompleteBar 崩溃:
【发布时间】:2017-12-06 22:03:17
【问题描述】:

我按照Customizing QuickType Suggestions in iOS 中的说明进行操作。 我因错误而崩溃

setAutocompleteWithDataSource:delegate:customize:]:无法识别 选择器发送到实例 0x7fe8c981bc00'

相关代码很简单:

@IBOutlet weak var brand: UITextField! 

override func viewDidLoad() { 
    super.viewDidLoad() 
    . . .
    self.brand.setAutocompleteWith(self, delegate: self, customize: { inputView in
            inputView?.isHidden = false
        })
}

我使用的是 Xcode 9.1 和 swift 3。当与 Objective C 一起使用时,我不理解闭包的语法。你能看到我的错误吗?

请注意,我添加了调用 setAutocompleteWith 的上下文。 viewDidLoad() 是调用的好地方吗?

【问题讨论】:

    标签: ios objective-c swift


    【解决方案1】:

    您似乎没有正确输入函数名称。

    试试这个:

    @IBOutlet weak var brand: UITextField! 
    
    self.brand.setAutocompleteWithDataSource(self, delegate: self, customize: { inputView in
                inputView?.isHidden = false
            })
    

    【讨论】:

    • 谢谢。但是当我尝试这样做时,Xcode 告诉我:setAutocompleteWithDataSource(_:delegate:customize:)' has been renamed to 'setAutocompleteWith(_:delegate:customize:)'
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多