- Tap Gesture Recognizer: タップ、ダブルタップ
- Pinch 〜: ピンチ
- Rotation 〜: 2本指でひねる回転操作
- Swipe 〜: スワイプ
- Pan 〜: パン(パニング、ドラッグ) ※パン、パニング=マウスbuttonIndexでいうドラッグのこと
- Long Press 〜: 長押し(タッチ&ホールド)
- floor(.) : 小数点以下切り捨て
- arc4random(): 乱数生成(u_int32_t)
- 初期化(シードを与える)が不要(srand() + rand()相当)
- intでキャストすると負数になることがあるよ。 http://qiita.com/jtemplej/items/abebac88f930f9345f95
- 乱数の偏り補正したarc4random_uniform()もある。違いは微妙らしい http://programming-ios.com/objective_c-arc4random/
- View の Modeを"Aspect Fit"にする
- iOS ビュープログラミングガイド p14 図1-2 コンテンツモードの比較 https://developer.apple.com/jp/devcenter/ios/library/documentation/ViewPG_iPhoneOS.pdf
- TP: chapter6-1-doubleTap
- UIPanGestureRecognizerを使う
- UIPanGestureRecognizer#translationInView()で移動後の相対位置が取得できる - 戻り値はCGPoint型。持っているx, yはCGFloat型
- UIPanGestureRecognizerのstateプロパティでフェーズが分かる
- https://developer.apple.com/library/ios/documentation/uikit/reference/UIGestureRecognizer_Class/Reference/Reference.html#//apple_ref/c/tdef/UIGestureRecognizerState
- UIGestureRecognizerStateBegan
- UIGestureRecognizerStateChanged
- UIGestureRecognizerStateEnded
- UIGestureRecognizerStateCancelled
- UIGestureRecognizerStateFailed
- UIGestureRecognizerStatePossible <-本には書いてない
- UIGestureRecognizerStateRecognized <-本には書いてない
- TP: chapter6-1-drag
- http://www.sotechsha.co.jp/sp/1022/
- 2刷正誤表
- p230からのコード間違い
- http://www.sotechsha.co.jp/sp/1022/img/p230_teisei.jpg
- dragging()メソッド中のローカル変数"*tombo"は不要
- "tombo.tarnsform"は、"_tombo.transform"に修正
- UIRotationGestureRecognizerを使う
- rotationプロパティに角度が入っている。float型。
- https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIRotateGestureRecognizer_Class/Reference/Reference.html#//apple_ref/occ/instp/UIRotationGestureRecognizer/rotation
- TP: chapter6-1-rotation
- UIPinchGestureRecognizerのscaleプロパティを使う
- UILongPressGestureRecognizerを使う
- UIImageViewのhiddenプロパティで表示、非表示を制御できる
- _arrow.hidden = YES // 非表示
- _arrow.hidden = NO // 表示
- animateWithDuration: アニメーションをおこなうメソッド
- duration : アニメーションさせる時間(秒)
- delay:いつ開始するか(秒)
- option:アニメーションの方法
- EaseOut:ゆっくり停止
- EaseIn:ゆっくりスタート
- EaseInOut:ゆっくりスタート、ゆっくり停止
- animation:アニメーションさせる内容を指定するブロック
- completion: 完了時に動くブロック
- chapter6-1-ex_UILongPressGR
- ボタン、スイッチなどの標準のコントロールの中には、「ラジオボタン」がない - みんな自作 or OSSを使っている
- UISwipeGestureRecognizerを使う
- UISwipeGestureRecognizerのdirectionプロパティで方向がわかる
- UISwipeGestureRecognizerDirectionRight, 〜Left, 〜Up, 〜Down
- インタラクティブ動作を受け取る
- userInteractionEnabledプロパティにYESを設定
- ジェスチャーのインスタンスを生成する
- UITapGestureRecognizer initWithTarget
- target:アクションを受け取るオブジェクト
- action:タップで実行するメソッド
- UITapGestureRecognizer initWithTarget
- ジェスチャー追加
- UIViewのaddGestureRecoginizerで追加する
- TP: chapter6-1-add_gesture
- UIGestureRecognizerのnumberOfTapsRequired : 認識されるために必要なタップ数。デフォルト1 - 参考:numberOfTouchesRequired:認識されるために必要な指の数。デフォルト1
- UIGestureRecognizer#requireGestureRecognizerToFail otherGestureRecoginzer
- (引数にしていした)otherGestureRecognizerとして認識されなかった時だけ実行されるようにする
- http://uqtimes.blogspot.jp/2012/05/1-ios.html ←概念図あり