2016-05-25 13 views
0

私はこのMRProgressライブラリを使用しています。引数としてはUINavigationControllerが必要です。しかし、私のViewController(これはモーダルとして表示されます)では、自分でUINavigationBarを作成します。UINavigationBarをUINavigationController(このライブラリで使用する)にするにはどうすればよいですか?

// Create the navigation bar 
    navigationBar = UINavigationBar(frame: CGRectMake(0, 0, self.view.frame.size.width, 44 + statusBarHeight())) 
    navigationBar.backgroundColor = UIColor.whiteColor() 
    navigationBar.delegate = self; 

    // Create a navigation item with a title 
    let navigationItem = UINavigationItem() 
    navigationItem.title = "New Conversation" 
    navigationBar.titleTextAttributes = [ 
     NSForegroundColorAttributeName: COLORS.logo0, 
     NSFontAttributeName: FONTS.title 
    ] 

    //Back Button 
    let backButton = UIButton(type: .Custom) 
    backButton.addTarget(self, action: #selector(CreateSessionViewController.backButtonAction(_:)), forControlEvents: UIControlEvents.TouchUpInside) 
    backButton.frame = CGRectMake(0, 0, 20, 20) 
    let cross = UIImage(named: "cross.png") 
    backButton.tintColor = UIColor(hex: 0xcccccc) 
    backButton.setImage(cross?.imageWithRenderingMode(.AlwaysTemplate), forState: UIControlState.Normal) 
    backButtonBar = UIBarButtonItem(customView: backButton) 
    navigationItem.leftBarButtonItems = [backButtonBar] 

    //Add nav bar 
    navigationBar.items = [navigationItem] 
    self.view.addSubview(navigationBar) 

このナビゲーションバーを引数としてライブラリに渡すにはどうすればよいですか?これは、ライブラリがサポートするものです。

MRNavigationBarProgressView(forNavigationController: UINavigationController!)

答えて

0

それは理にかなっている場合、あなたはモーダルこのViewControllerをラップUINavigationControllerを提示できました。

関連する問題