如何在 WatchKit 中获取 Swift 或 Objective-C 中的标签文本?
该类不是 UILabel,而是 WKInterfaceLabel。
我也尝试过搜索苹果的类库 https://developer.apple.com/library/prerelease/ios/documentation/WatchKit/Reference/WKInterfaceLabel_class/index.html#//apple_ref/doc/uid/TP40014960-CH1-DontLinkElementID_4但只有三种方法可用。
By reading reference https://developer.apple.com/library/prerelease/ios/documentation/WatchKit/Reference/WKInterfaceLabel_class/index.html#//apple_ref/doc/uid/TP40014960-CH1-DontLinkElementID_4 it is not possible you have to maintain track which you set in label
looks like apple is very strict about this class you can not create a subclass or direct instance of this.
They only talk about how to set the text not about getting text
Non of it's supper class have method to get text
If its posible You can create extension of WKInterfaceLabel and get text
but no idea if apple approve it or not.
我的结论是
不可能通过任何方式直接获取文本
你可以做一些技巧,但要确保它被苹果接受。
Friendly speaking i am not much aware about watch SDK, but if you dealing with any beta version of type thing let hope that apple will add that thing in new version as they had wrote
Reference of all i wrote and images are
here https://developer.apple.com/library/prerelease/ios/documentation/WatchKit/Reference/WKInterfaceLabel_class/index.html#//apple_ref/doc/uid/TP40014960-CH1-DontLinkElementID_4
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)