Class: Toybox::WatchUi::View
View クラスは 描画ページの基礎クラスです。 アプリの各ビューのライフサイクルを扱う。
widgets と watch-apps のライフサイクルは
- onStart()
- onLayout()
- onShow()
- onUpdate()
- onHide()
watchfaces と datafields のライフサイクルは
- onLayout()
- onShow()
- onUpdate()
となる。データフィールドでは、サイズが最後の onUpdate() からサイズが変更されたら、 onLayout() が呼び出される。SimpleDataField オブジェクトはまた違うライフサイクルを持ち、上記の関数が呼び出されることはない。
直下のサブクラス
Instance Method Summary
- (WatchUi.Drawable) findDrawableById(id) : Find a Drawable by its ID.
- (Object) onHide : Before the View is removed from the foreground, onHide() is called.
- (Boolean) onLayout(dc) : The entry point for the View is onLayout().
- (Boolean) onShow : When the View is brought into the foreground, onShow() is called.
- (Boolean) onUpdate(dc) : When a View is active, onUpdate() is used to update dynamic content.
- (Object) setLayout(layout) : Use setLayout() to set the layout for the View.
Instance Method Details
(WatchUi.Drawable) findDrawableById(id)
Find a Drawable by its ID.
- Parameters
- id (String) : The ID of the Drawable to find
- Returns : (WatchUi.Drawable) The Drawable if found, null otherwise
- Since : 1.0.0
(Object) onHide : View がフォアグラウンドから削除される前に呼び出される。
ビューをページスタックに残す際、ここでメモリからリソースを開放する。
(Boolean) onLayout(dc) : View のエントリポイント
リソースをロードしビューのレイアウトがセットされる前に呼び出される。
- Parameters
- dc (Graphics.Dc) : The drawing context
- Returns : (Boolean) true if handled, false otherwise
- Since : 1.0.0
(Boolean) onShow
When the View is brought into the foreground, onShow() is called. This is where you should load resources into system memory for use in this view.
- Returns : (Boolean) true if handled, false otherwise
- Since : 1.0.0
(Boolean) onUpdate(dc) : アクティブなビューの、内容を更新する
フォアグラウンドのViewに対して呼び出される。widgets と watch-apps では、WatchUi.requestUpdate() が実行されると、呼び出される。 watchfaces では毎分、datafields では毎秒呼び出される。
If a class that extends View does not implement this function then any Drawables contained in the View will automatically be drawn.
- Parameters
- dc (Graphics.Dc) :描画コンテクスト
- Returns : (Boolean) true if handled, false otherwise
- Since : 1.0.0
(Object) setLayout(layout)
レイアウト情報を読み込む。
拡張クラスが onUpdate() をオーバーライドしていなければ、すべてのlayout に含まれる Drawables が自動的に View に描画される。
- Parameters
- layout (Layout) : An array of Drawables
- Since : 1.0.0
最終更新:2018年04月08日 22:14