ios swiftでPPRevealsideViewControlを使用

2270 ワード

  • podファイルに
  • を追加
    pod 'PPRevealSideViewController' 
  • consoleの下で
  • を実行
    pod install
  • xcodeでworkspaceファイル
  • を開く
  • AppDelegate.swiftファイルでPPRevealsideViewControlを設定する
  • 変数
  • を定義する
    var theRevealSideViewController: PPRevealSideViewController!
    
  • Creating PPRevealSideViewController
        func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
            // Override point for customization after application launch.
            theRevealSideViewController = PPRevealSideViewController(rootViewController: self.window?.rootViewController);
            self.window?.rootViewController = theRevealSideViewController;
    
            return true
        }

  • は、右側からポップアップするウィンドウ
  • をマスタインタフェース上で開く.
            self.aboutViewController = AboutViewController(nibName: "AboutViewController", bundle: nil)
    @IBAction func aboutBtnClicked(sender: AnyObject){
            NSLog("  about   ")
            self.revealSideViewController.pushViewController(self.aboutViewController, onDirection: PPRevealSideDirection.Right, animated: true)
    }