2016-09-27 90 views
1

我想要導航欄擴展中的這兩個菜單,並在滾動時隱藏除擴展名外的導航欄。頁面菜單,滾動時隱藏導航欄

我是能夠實現的菜單與PageMenu「PageMenu」和隱藏的導航欄,通過AMScrollingNavbar

enter image description here

但我現在面臨的問題是導航欄皮,但意見不動了導航欄

func loadControllers(){ 

    let storyboard = UIStoryboard(name: "Main", bundle: nil) 

    let topViewController = storyboard.instantiateViewControllerWithIdentifier("TopNewsController") as! 
    TopNewsController 

    topViewController.title = "TOP" 
    controllerArray.append(topViewController) 

    let briefViewController = storyboard.instantiateViewControllerWithIdentifier("BriefViewController") as! 
    BriefViewController 

    briefViewController.title = "BRIEFS" 
    controllerArray.append(briefViewController) 


    let videoViewController = storyboard.instantiateViewControllerWithIdentifier("VediosViewController") as! 
    VediosViewController 

    videoViewController.title = "VIDEOS" 
    controllerArray.append(videoViewController) 


    // Customize menu 
    parameters = [ 
     .ScrollMenuBackgroundColor(UIColor.navigationBarColor()), 
     .ViewBackgroundColor(UIColor(red: 20.0/255.0, green: 20.0/255.0, blue: 20.0/255.0, alpha: 1.0)), 
     .SelectionIndicatorColor(UIColor.whiteColor()), 
     .BottomMenuHairlineColor(UIColor(red: 70.0/255.0, green: 70.0/255.0, blue: 80.0/255.0, alpha: 1.0)), 
     .MenuItemFont(UIFont(name: "HelveticaNeue-Bold", size: 14.0)!), 
     .MenuHeight(expressTribuneUtilities.convertIphone6ToIphone5(48)), 
     .MenuItemWidth(90.0), 
     .CenterMenuItems(true) 
    ] 


    AppDelegate.getInstatnce().nav = self.navigationController as! ScrollingNavigationController 
    AppDelegate.getInstatnce().nav.scrollingNavbarDelegate = self 


    // Initialize scroll menu 
    pageMenu = CAPSPageMenu(viewControllers: controllerArray, frame: CGRectMake(0.0, 64.0, self.view.frame.width, self.view.frame.height), pageMenuOptions: parameters) 

    self.view.addSubview(pageMenu!.view) 

} 

enter image description here

呼叫從類這就是滾動方法在菜單

 AppDelegate.getInstatnce().nav.followScrollView(tableMainView, delay: 0.5) 
+0

在最後一行是什麼'self.view'。 –

回答

2
AppDelegate.getInstatnce().nav = self.navigationController as! ScrollingNavigationController 
AppDelegate.getInstatnce().nav.scrollingNavbarDelegate = self 

變化都行加入到喜歡這個它不會工作,因爲你正在爲其他實例,而不是您的導航設置委託。

 let navController = AppDelegate.getInstatnce().window?.rootViewController as! ScrollingNavigationController 
    navController.scrollingNavbarDelegate = self 

實現控制器delgate和你的觀點w.r.t您 滾動型設定的原點。