导航项按钮未显示

时间:2015-12-29 07:50:16

标签: ios iphone swift uinavigationcontroller swift2

问题:导航但未显示

我真的被导航控制器困住了。

以下是Appdelegate中导航控制器的代码:

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    IQKeyboardManager.sharedManager().enable = true
    SVProgressHUD.setDefaultMaskType(SVProgressHUDMaskType.Black)
    // Override point for customization after application launch.
    window = UIWindow(frame: UIScreen.mainScreen().bounds)
    storyboard = UIStoryboard(name: "Main", bundle: nil)
    let controller:ViewController = self.storyboard.instantiateViewControllerWithIdentifier("ViewController") as! ViewController
    navigation = UINavigationController(rootViewController: controller)
    window?.rootViewController = navigation
    window?.makeKeyAndVisible()
    // Override point for customization after application launch.
    return true

}

所以这个导航控制器工作到最后一个屏幕,在我的上一个屏幕中我想制作滑块,所以我在我的viewdidload中调用了一个函数

myqueto viewcontroller



 override func viewDidLoad() {
    super.viewDidLoad()

 self.addSlideMenuButton()

}

主要的是我从“baseviewcontroller”得到“myquetoviewcontroller”

class myquoetoViewController: BaseViewController,UITableViewDataSource,UITableViewDelegate {

这是baseview controller

中的功能
 func addSlideMenuButton(){
    let btnShowMenu = UIButton(type: UIButtonType.System)
    btnShowMenu.setImage(self.defaultMenuImage(), forState: UIControlState.Normal)
    btnShowMenu.frame = CGRectMake(0, 0, 30, 30)
    btnShowMenu.addTarget(self, action: "onSlideMenuButtonPressed:", forControlEvents: UIControlEvents.TouchUpInside)
    let customBarItem = UIBarButtonItem(customView: btnShowMenu)
    self.navigationItem.leftBarButtonItem = customBarItem;
}

func defaultMenuImage() -> UIImage {
    var defaultMenuImage = UIImage()

    struct Static {
        static var onceToken: dispatch_once_t = 0
    }

    dispatch_once(&Static.onceToken, { () -> Void in
        UIGraphicsBeginImageContextWithOptions(CGSizeMake(30, 22), false, 0.0)

        UIColor.blackColor().setFill()
        UIBezierPath(rect: CGRectMake(0, 3, 30, 1)).fill()
        UIBezierPath(rect: CGRectMake(0, 10, 30, 1)).fill()
        UIBezierPath(rect: CGRectMake(0, 17, 30, 1)).fill()

        UIColor.whiteColor().setFill()
        UIBezierPath(rect: CGRectMake(0, 4, 30, 1)).fill()
        UIBezierPath(rect: CGRectMake(0, 11,  30, 1)).fill()
        UIBezierPath(rect: CGRectMake(0, 18, 30, 1)).fill()

        defaultMenuImage = UIGraphicsGetImageFromCurrentImageContext()

        UIGraphicsEndImageContext()
    })

    return defaultMenuImage;
}

那么我应该如何管理呢......还有一件事是滑块正常工作它只是没有显示navigationbaritem按钮图标..

this is what i got

this is what i want

2 个答案:

答案 0 :(得分:0)

因此,添加故事板ID以显示视图控制器,如RevealVC或其他

    let secondViewController = self.storyboard?.instantiateViewControllerWithIdentifier("RevealVC") as SecondViewController

    self.navigationController?.pushViewController(secondViewController, animated: true)

答案 1 :(得分:0)

试试这个:

console.log(document.getElementById('output').innerHTML);