サービス
サービスを探す
プロ人材を探す
仕事を探す
ブログを探す
from ui import View
class カスタムビュー(View):
def イベントメソッド(self):
処理
def __init__(self):
def did_load(self):
※ add_subview()で追加したビューでは呼び出されないので
__init__()の最後で呼び出す
def will_close(self):
※ remove_subview()で削除したビューでは呼び出されないので
remove_subview()の前に呼び出す
def touch_began(self, touch):
def touch_began(self, touch):
self.start_pos = touch.location
def touch_ended(self, touch):
end_pos = touch.location
dx = end_pos[0] - self.start_pos[0]
dy = end_pos[1] - self.start_pos[1]
if 座標判定:
スワイプの処理
def touch_began(self, touch):
self.start_time = time.time()
def touch_ended(self, touch):
end_time = time.time()
duration = end_time - self.start_time
if タッチ時間の判定:
長押しの処理
①.pyuiファイル で View を選択
②i アイコン
③Custom View Class に カスタムViewのクラス名を入力