swift学习记录(selector)
2015-04-05 16:03
232 查看
转载自:http://stackoverflow.com/questions/24007650/selector-in-swift
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithObjective-CAPIs.html#//apple_ref/doc/uid/TP40014216-CH4-XID_26
原文:An Objective-C selector is a type that refers to the name of an Objective-C method.
In Swift, Objective-C selectors are represented by the
You can construct a selector with a string literal, such as
any method that accepts a selector.
翻译:在Objective-C 中 selector是指向方法名的类型,在swift中Selector由结构构造,你可以直接用字符串构造一个Selector,例如:let
mySelector = "tappedButton",因为字符串可以自动转化成selectors,你可以直接输入方法名的字符串,来适配一个selector。
原文:NOTE
The
and related selector-invoking methods are not imported in Swift because they are inherently unsafe.
翻译:注意:
performSelector方法和设计selector的方法并没有在Swift中被引入,因为他们是不安全(固有的)的。
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithObjective-CAPIs.html#//apple_ref/doc/uid/TP40014216-CH4-XID_26
原文:An Objective-C selector is a type that refers to the name of an Objective-C method.
In Swift, Objective-C selectors are represented by the
Selectorstructure.
You can construct a selector with a string literal, such as
let mySelector: Selector = "tappedButton:". Because string literals can be automatically converted to selectors, you can pass a string literal to
any method that accepts a selector.
翻译:在Objective-C 中 selector是指向方法名的类型,在swift中Selector由结构构造,你可以直接用字符串构造一个Selector,例如:let
mySelector = "tappedButton",因为字符串可以自动转化成selectors,你可以直接输入方法名的字符串,来适配一个selector。
原文:NOTE
The
performSelector:method
and related selector-invoking methods are not imported in Swift because they are inherently unsafe.
翻译:注意:
performSelector方法和设计selector的方法并没有在Swift中被引入,因为他们是不安全(固有的)的。
相关文章推荐
- swift 学习 记录
- Swift学习过程问题记录
- swift学习记录(enumerate)
- swift学习记录03-集合:数组、字典
- swift学习记录(private和public)
- erlang服务器操作 Swift 学习 记录
- Swift 学习记录—1
- swift学习记录(designated init 和convenience init)
- swift学习记录(in)
- Swift学习记录(Swift和Object-C混编之可选值类型的选择)
- Swift学习感悟记录
- swift学习记录(func)
- swift学习记录(for)
- swift学习记录(iso开发设计性能提升)
- 操作 swift学习记录(-)
- 记录学习Swift的过程
- swift学习记录(switch)
- swift学习记录(实例方法和类型方法)
- Swift学习之每日一tip (1)Selector
- Swift学习记录(UITableView can not find member ...)