我可以在watchKit上使用IBInspectable嗎? 當我將一個字符串標記爲IBInspectable時,我可以在相關的WatchKit應用程序故事板上看到並設置它,但是當我設置它時,它實際上什麼都不做。IBInspectable&watchkit
3
A
回答
7
你不能,因爲對於WatchKit他們是接口對象而不是查看。蘋果有意爲它們使用不同的術語,因爲它們根本不同。
界面對象是代理對象在實際應用手錶(而不是WatchKit擴展)的實際意見。他們通過藍牙通過WatchKit進行通信,以實際操作手錶顯示屏上實際視圖的相應屬性。
當您設置WKInterfaceLabel
的文本時,它所做的只是記錄要進行的更改,然後將運行循環中的其他更改的更改作爲批處理髮送到手錶。 Watch OS將從這些代理對象中獲取所有信息,並實際更改Watch上的UILabel
上的文本。
因此,IBDesignable和IBInspectable在這裏不會真正起作用。雖然它們在Interface Builder中以相似的方式表示,但它們實際上是不同的。
2
根據我的經驗,您可以將屬性標記爲IBInspectable,並且該屬性將顯示在界面構建器的檢查器面板中。但是,正如您所指出的那樣,這些值並不是由WatchKit填充的。
相關問題
- 1. IBInspectable UIView屬性
- 2. watchkit to watchkit通訊#Watchkit擴展
- 3. @IBInspectable在雨燕4.0
- 4. Watchkit Animation
- 5. 創建IBInspectable的Unicode字符
- 6. @IBInspectable不更新故事板
- 7. Watchkit和WCSession
- 8. WatchKit表空白
- 9. WatchKit NSAppTransportSecurity錯誤
- 10. WatchKit上傳
- 11. Watchkit App:slider background color
- 12. Watchkit,dismissController功能
- 13. Watchkit&Realm 0.92.3
- 14. WatchKit調用webview
- 15. Watchkit OS 2,AVSpeechSynthesizer
- 16. WatchKit openParentApplication:回覆
- 17. WatchKit NSUserDefaults爲空
- 18. 設置WatchKit表
- 19. 無法在WatchKit
- 20. WatchKit UIPageControl Dot Color
- 21. WatchKit問題:SPErrorInvalidBundleNoGizmoBinaryMessage
- 22. iOS中的動態IBInspectable枚舉
- 23. IBInspectable不關於INT或UINT工作
- 24. UIButton的邊框顏色使用IBInspectable
- 25. IBInspectable屬性值不在xib中更新
- 26. 如何獲取IBInspectable var值並返回?
- 27. xcode - @IBInspectable如何添加顏色字段
- 28. 如何在Xcode中記錄@IBInspectable屬性
- 29. 使用IBDesignable和IBInspectable預覽CAShapeLayer
- 30. Xcode 6 @IBInspectable:初始化爲初始值?