ios swift下使用PPRevealSideViewController

史超英
2023-12-01
  • 在pod文件里面加入
pod 'PPRevealSideViewController' 
  • console下面运行
pod install
  • 用xcode打开workspace 文件
  • 在AppDelegate.swift文件中设置PPRevealSideViewController

    • 定义一个变量
    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)
}
 类似资料: