opening uialertcontroller
on button click, action going open main issue uialertaction
methods not performed on click. here code block :
class homeviewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() // getdata() } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } //menubtn button @ibaction func menubtn(sender: uibutton) { let optionmenu = uialertcontroller(title: nil, message: nil, preferredstyle: .actionsheet) let orders = uialertaction(title: "orders", style: .default, handler: { (alert: uialertaction!) -> void in let alertviewcontroller = self.storyboard?.instantiateviewcontrollerwithidentifier("ordersviewcontroller") as! ordersviewcontroller self.presentviewcontroller(alertviewcontroller, animated: true, completion: nil) }) let = uialertaction(title: "about", style: .default, handler: {(alert: uialertaction!) -> void in let aboutobject = self.storyboard?.instantiateviewcontrollerwithidentifier("aboutviewcontroller") as! aboutviewcontroller self.presentviewcontroller(aboutobject, animated: true, completion: nil) }) let contactus = uialertaction(title: "contact us", style: .default, handler: {(alert: uialertaction!) -> void in let alertviewcontroller = self.storyboard?.instantiateviewcontrollerwithidentifier("contactviewcontroller") as! contactviewcontroller self.presentviewcontroller(alertviewcontroller, animated: true, completion: nil) }) let login = uialertaction(title: "login", style: .default, handler: {(alert: uialertaction!) -> void in let alertviewcontroller = self.storyboard?.instantiateviewcontrollerwithidentifier("loginviewcontroller") as! loginviewcontroller self.presentviewcontroller(alertviewcontroller, animated: true, completion: nil) }) let cancelaction = uialertaction(title: "cancel", style: .cancel, handler: nil) optionmenu.addaction(orders) optionmenu.addaction(about) optionmenu.addaction(contactus) optionmenu.addaction(login) optionmenu.addaction(cancelaction) self.presentviewcontroller(optionmenu, animated: true, completion: nil) }
this code working fine, have checked it's opening new viewcontroller
well.
cross check points:
- controller class ,
stroybaord
connected storyboard id
has been assigned- ibaction must connected iboutlet
Comments
Post a Comment