Tests测试 | ✗ |
Lang语言 | SwiftSwift |
许可证 | MIT |
Released最新发布 | 2017年4月 |
SwiftSwift版本 | 3.1 |
SPM支持SPM | ✗ |
由Pierre Perrin维护。
PPMusicImageShadow是一个视图,它实时模仿了iOS音乐应用中的阴影模糊效果。
如果您喜欢,可以克隆项目,发布框架或直接使用Swift文件。
首先,在Storyboard上添加一个"Main" ViewController,作为PPMenuContainerViewController的子类,并将其作为初始ViewController。
然后,将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