我目前正在使用一个名为的表单构建库
尤里卡( https://github.com/xmartlabs/Eureka)由于某种原因
每当我构建一个表单时,导航栏都不会出现
我的视图控制器嵌入在导航控制器中,它是
设置为可见.任何帮助?这是我的回购:
https://github.com/ariff20/iTutor
尤里卡( https://github.com/xmartlabs/Eureka)由于某种原因
每当我构建一个表单时,导航栏都不会出现
我的视图控制器嵌入在导航控制器中,它是
设置为可见.任何帮助?这是我的回购:
https://github.com/ariff20/iTutor
码
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
解决方法
你正在展示你的ViewController,如下所示:
let vc = storyboard!.instantiateViewControllerWithIdentifier("TutorSignUp") as! SignUpViewController self.presentViewController(vc,animated: true,completion: nil)
所以你的SignUpViewController实际上没有UINavigationController作为父.
这将解决这个问题:
let vc = storyboard!.instantiateViewControllerWithIdentifier("TutorSignUp") as! SignUpViewController let navigationController = UINavigationController(rootViewController: vc) self.presentViewController(navigationController,completion: nil)