导航栏没有出现? [英] Navigation bar not appearing?
本文介绍了导航栏没有出现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在使用一个名为的表单构建库Eureka(
2
3
解决方案
您正在像这样显示ViewController:
让vc =情节提要!.instantiateViewControllerWithIdentifier("TutorSignUp")为!SignUpViewControllerself.presentViewController(vc,动画:true,完成:无)
因此您的 SignUpViewController
实际上没有父代 UINavigationController
.
这将解决以下问题:
让vc =情节提要!.instantiateViewControllerWithIdentifier("TutorSignUp")为!SignUpViewController让navigationController = UINavigationController(rootViewController:vc)self.presentViewController(navigationController,动画:true,完成:无)
I am currently using a form building library called Eureka(https://github.com/xmartlabs/Eureka) and for some reason whenever I build a form,the navigation bar is not appearing eventhough my view controller is embedded in a navigation controller and it is set to visible.Any help? Here's my repo: https://github.com/ariff20/iTutor
Code
class SignUpViewController: FormViewController ,UINavigationBarDelegate{
override func viewDidLoad() {
super.viewDidLoad()
let logButton : UIBarButtonItem = UIBarButtonItem(title: "RightButtonTitle", style: UIBarButtonItemStyle.Done, target: self,action: "multipleSelectorDone")
self.navigationController?.navigationBar.hidden = false
self.navigationItem.rightBarButtonItem = logButton
form +++ Section("Your Basic Details")
<<< NameRow()
{
$0.placeholder = "Your Name"
}
<<< EmailRow()
{
$0.placeholder = "Email"
}
<<< PasswordRow()
{
$0.placeholder = "Password"
}
<<< PhoneRow()
{
$0.placeholder = "Your phone no,Customers will see this"
}
+++ Section("Select your Expertise")
<<< MultipleSelectorRow<String>
{
$0.title = "Choose your Subjects"
$0.options = ["English","Mandarin","Maths","Science","Bahasa Malaysia"]
}
.onPresent { from, to in
to.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Done, target: from, action:"multipleSelectorDone:")
}
<<< MultipleSelectorRow<String>
{
$0.title = "Choose your levels"
$0.options = ["Standard 1-3","Standard 4-6","Form 1-3","Form 4-5"]
}
.onPresent { from, to in
to.navigationItem.rightBarButtonItem = logButton}
<<< MultipleSelectorRow<String>
{
$0.title = "Choose your pricing range"
$0.options = ["RM30-RM40","RM40-RM60","RM60-RM80","RM80-RM100"]
}
.onPresent { from, to in
to.navigationItem.rightBarButtonItem = logButton}
+++ Section("Where can you teach?")
<<< TextRow()
{
$0.placeholder = "State"
}
<<< TextRow()
{
$0.placeholder = "Town,ex:Near Shah Alam"
}
}
override func viewWillAppear(animated: Bool)
{
super.viewWillAppear(true)
self.navigationController?.navigationBarHidden=false
}
func multipleSelectorDone(item:UIBarButtonItem)
{
navigationController?.popViewControllerAnimated(true)
}
OUTPUT
1
2
3
解决方案
You're presenting your ViewController like this:
let vc = storyboard!.instantiateViewControllerWithIdentifier("TutorSignUp") as! SignUpViewController
self.presentViewController(vc, animated: true, completion: nil)
so your SignUpViewController
doesn't actually have a UINavigationController
as a parent.
This will fix that:
let vc = storyboard!.instantiateViewControllerWithIdentifier("TutorSignUp") as! SignUpViewController
let navigationController = UINavigationController(rootViewController: vc)
self.presentViewController(navigationController, animated: true, completion: nil)
这篇关于导航栏没有出现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文