button.addTarget(self, action: #selector(ViewController.TapButton), for: .touchUpInside)
let image = UIImage(named: "icon")?.withRenderingMode(.alwaysOriginal)
button.setBackgroundImage(UIImage(named: "Image"), for: .normal)
谁能帮忙解释下么,.TapButton / .alwaysOriginal / .normal 这种是什么语法,为什么能直接[.属性名]调用啊。swift文档上没找到答案,知道的请解释下呢。
就是当参数或变量是一个枚举类型时,可以简写,编译器会自动隐式推断。
官方文档原文(红框处):