PPLeftMenuNavigation 1.0.3

PPLeftMenuNavigation 1.0.3

Tests测试
Lang语言 SwiftSwift
许可证 MIT
Released最新发布2017年4月
SwiftSwift版本3.1
SPM支持SPM

Pierre Perrin维护。



  • <在此处输入您的名字>

PPMusicImageShadow

概要

PPMusicImageShadow是一个视图,它实时模仿了iOS音乐应用中的阴影模糊效果。

alt tag alt tag

安装

手动

如果您喜欢,可以克隆项目,发布框架或直接使用Swift文件。

代码示例

首先,在Storyboard上添加一个"Main" ViewController,作为PPMenuContainerViewController的子类,并将其作为初始ViewController。

alt tag

然后,将PPLeftMenuDatasource协议添加到您的main ViewController中(该协议与UITableViewDelegate协议类似,但更加简单)。

class MainViewController: PPMenuContainerViewController, PPLeftMenuDatasource {

    var items : [PPLeftMenuItem] = [
    PPLeftMenuItem.init(WithText: "FirstItemTitle", icon: UIImage.init(named: "FirstIcon")),
    PPLeftMenuItem.init(WithText: "SecondItemTitle", icon: UIImage.init(named: "SecondIcon")),
    PPLeftMenuItem.init(WithText: "ThirdItemTitle", icon: UIImage.init(named: "ThirdIcon"))
    ]

    //Here you set 
    override func awakeFromNib() {
        super.awakeFromNib()

        self.datasource = self
        if let vc = self.storyboard?.instantiateViewController(withIdentifier: "YourViewControllerIdentifierForYourFirstItem"){
            self.contentViewController = vc
        }
    }

    func numberOfItem() -> Int {
        return items.count
    }

    func itemForRow(row: Int) -> PPLeftMenuItem {
        return items[row].leftMenuItem
    }

    func didSelectRow(atIndex index: Int, item : PPLeftMenuItem) {
        if let vc = self.storyboard?.instantiateViewController(withIdentifier: "viewControllerForSelectedRow"){

            //Here you change the viewcontroller (with a fade animation or a blur transition)
            self.setContentViewController(viewController: vc, animated: true,blurTransition: true)
        }
    }

    //Here you can add a header to the menu view
    var menuHeaderView: UIView?{
        return nil
    }

    //Here you can add a footer to the menu view
    var menuFooterView: UIView?{
        return nil
    }
}

个性化

在awakeFromNib()中个性化菜单。

    //change the menu background
    self.backgroundImage 

    //add a background effet on the menu
     self.addBlurToBackground = true
    
    //The blur effect style of menu and transition
    self.blurEffect : UIVisualEffect! = //Your desire effect
    self.backgroundBlurEffect : UIVisualEffect! = //Your desire effect