Quantcast
Channel: iOS開発者@日本 » UIViewController
Viewing all articles
Browse latest Browse all 2

オープンソースライブラリ:PKRevealController エレガントなiOSビューコントローラコンテナ

0
0
    • 概要:PKRevealControllerはエレガントなiOSビューコントローラコンテナです。
      複数のコントローラのビュー階層構造を簡単に設定できる柔軟性が高いのビューコントローラコンテナです。
      PKRevealController
    • ダウンロードURL:https://github.com/pkluz/PKRevealController
    • 開発者:Philip Kluz
    • ブログ:https://github.com/pkluz
    • サポート: Xcode4.5+、iOS5.0+、ARC
    • ライセンス:MIT

  • メイン機能:
    ①豊富なビューコントローラコンテナ機能
    ②エレガントなブロックAPI
    ③左右両方からのサイドビューのプレゼンテーションをサポート
    ④iPhoneとiPad両方サポート
    ⑤デバイスの縦向き/横向きを両方サポート
  • 導入方法:
  1. cocoapodsを利用、導入するのは一番簡単です。Podfileに「pod ‘PKRevealController’」を追加、下記コマンドを実行するだけで、完了です。
    $ pod install
    cocoapodsに関して、本サイト以前の文章「開発レシピ:Objective-Cのライブラリ管理ツール CocoaPods」を参照してください。
    次は手動で導入する方法を紹介します。
  2. ダウンロードURLから直接にダウンロードする。
    gitを利用してソースを取得する場合、ターミナルで以下のコマンドを実行する。
    $ git clone https://github.com/pkluz/PKRevealController.git
  3. PKRevealControllerをプロジェクトに追加する
    「PKRevealController\Controller」フォルダをプロジェクトにドラッグ&ドロップする。
    ※ポップアップダイアログの「Copy items into destination group’s folder(if needed)」とターゲットチェックボクスの選択を忘れないでください。
  4. QuartzCore.frameworkをプロジェクトに追加する
    ターゲットの「Build Phases」⇒「Link Binary With Libraries」セクション左下の「+」ボタンを押下
    ライブラリの追加

    ライブラリの追加

    sex photos nude pictures

    ライブラリの選択画面で「QuartzCore.framework」を選択、「Add」ボタンを押下。

  • 実装方法:
    ①ヘッダーファイルをインポートする:
    #import "PKRevealController.h"
    ②PKRevealControllerオブジェクトの作成:
    1. // PKRevealControllerのオプション設定
    2. // オプションの詳細:⑤を参照
    3. NSDictionary *options = @{
    4. PKRevealControllerAllowsOverdrawKey : [NSNumber numberWithBool:YES],
    5. PKRevealControllerDisablesFrontViewInteractionKey : [NSNumber numberWithBool:YES]
    6. };
    7. // PKRevealControllerオブジェクトの作成
    8. PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:frontVC leftViewController:leftVC options:options];
    9. self.window.rootViewController = revealController;

    ③サイトビューの幅設定:
    viewDidLoadメソッドの中で設定する
    1. - (void)viewDidLoad
    2. {
    3. [super viewDidLoad];
    4. [self.revealController setMinimumWidth:220.0f maximumWidth:244.0f forViewController:self];
    5. }

    ④サイドビューの間にメッセージ送信
    revealControllerを通じてお互いにメッセージ送信できる
    1. [self.revealController.frontViewController description];

    ⑤PKRevealControllerのオプション一覧
    1. /*
    2. * フロントビューの移動アニメーションかかる時間
    3. *
    4. * @default 0.185sec
    5. * @value NSNumber containing an NSTimeInterval (double)
    6. */
    7. extern NSString * const PKRevealControllerAnimationDurationKey;/*
    8. * フロントビューの移動アニメーションカーブ設定
    9. *
    10. * @default UIViewAnimationCurveLinear
    11. * @value NSNumber containing a UIViewAnimationCurve (NSUInteger)
    12. */
    13. extern NSString * const PKRevealControllerAnimationCurveKey;/*
    14. * コントローラのアニメーションタイプ
    15. *
    16. * @default PKRevealControllerAnimationTypeStatic
    17. * @value NSNumber containing a PKRevealControllerAnimationType (NSUInteger)
    18. */
    19. extern NSString * const PKRevealControllerAnimationTypeKey;/*
    20. * オーバードロー可否の設定
    21. *
    22. * @default YES
    23. * @value NSNumber containing BOOL
    24. */
    25. extern NSString * const PKRevealControllerAllowsOverdrawKey;
    26.  
    27. /*
    28. * フロントビュー移動をトリガするスワイプ速度の最小値
    29. *
    30. * @default 800.0f
    31. * @value NSNumber containing CGFloat
    32. */
    33. extern NSString * const PKRevealControllerQuickSwipeToggleVelocityKey;
    34.  
    35. /*
    36. * サイトビューが表示される時、フロントビューのインタラクションを無効するかどうかの設定
    37. *
    38. * @default YES
    39. * @value NSNumber containing BOOL
    40. */
    41. extern NSString * const PKRevealControllerDisablesFrontViewInteractionKey;
    42.  
    43. /*
    44. * フロントビュー全体にUIPanGestureRecognizerを設定、パンジェスチャーを感知するかどうかの設定
    45. *
    46. * @default YES
    47. * @value NSNumber containing BOOL
    48. */
    49. extern NSString * const PKRevealControllerRecognizesPanningOnFrontViewKey;
    50.  
    51. /*
    52. * フロントビュー全体にUITapGestureRecognizerを設定、サイドビューが表示される場合、
    53. * スナップバック・オン・タップ機能を有効するかどうかの設定
    54. *
    55. * @default YES
    56. * @value NSNumber containing BOOL
    57. */
    58. extern NSString * const PKRevealControllerRecognizesResetTapOnFrontViewKey;

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images