我正在使用此MRProgress库。它需要UINavigationController
作为参数。但是,在我的ViewController
(以模态形式呈现)中,我自己创建了UINavigationBar
。
// 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 :(得分:0)
如果有意义,您可以以模态方式呈现包裹此UINavigationController
的{{1}}。