Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 威夫特-巴布托教派头衔_Ios_Swift_Uibarbuttonitem - Fatal编程技术网

Ios 威夫特-巴布托教派头衔

Ios 威夫特-巴布托教派头衔,ios,swift,uibarbuttonitem,Ios,Swift,Uibarbuttonitem,我得到的错误是“类型'UIBarButtonItem'的值没有成员'currentTitle',我也有每个按钮的枚举和大小写。试试gaurd let title=sender.title试试gaurd let title=sender.title它起作用了!我想我曾经试过,但那一定是在不同的变体上,因为现在它们注册了。”.成功了!我想我曾经试过,但那一定是另一种变化,因为现在它们注册了。 @IBAction func buttonTapped(_ sender: UIBarButtonItem)

我得到的错误是“类型'UIBarButtonItem'的值没有成员'currentTitle',我也有每个按钮的枚举和大小写。

试试
gaurd let title=sender.title

试试
gaurd let title=sender.title

它起作用了!我想我曾经试过,但那一定是在不同的变体上,因为现在它们注册了。”.成功了!我想我曾经试过,但那一定是另一种变化,因为现在它们注册了。
@IBAction
func buttonTapped(_ sender: UIBarButtonItem) {
  guard let title = sender.currentTitle,
        let button = Buttons(rawValue: title) else { return }
}