ios - Having trouble 'segueing' from one view controller to another, getting weird warnings -


i getting strange error. think compiler trying tell me can't segue view controller until done executing code in current view controller not sure.

i'm literally getting input using alert box (i.e. calling function called generatetextfield).

then when done i'm saying "hey want go view controller" - the compiler instead tells me "hey don't think so".

here error:

warning: attempt present hairstyle1viewcontroller: 0x7...> on browsebarbersviewcontroller: 0x7...> presenting warning: attempt present hairstyle1viewcontroller: 0x7..> on browsebarbersviewcontroller: 0x7...> presenting

@ibaction func addnewstylebuttonclicked(sender: anyobject)     {         // "hairstyle name" user         generatetextfield();          // ok done function, transition         // next screen         performseguewithidentifier("hairstyle1", sender: self);     }        // generate text field user input (i.e. call alert function)     func generatetextfield()     {          //1. create alert controller.         var tempstyle = "";         var alert = uialertcontroller(title: "add new style", message: "enter name of new hairstyle below", preferredstyle: .alert);           //2. add text field. can configure need.         alert.addtextfieldwithconfigurationhandler({ (textfield) -> void in             textfield.placeholder = "your new hairstyle goes here..";         })          //3. grab value text field, , print when user clicks ok.         alert.addaction(uialertaction(title: "ok", style: .default, handler: { (action) -> void in             let textfield = alert.textfields![0] uitextfield             tempstyle = textfield.text!;             print("new style added is: " + tempstyle);             hairstyle = tempstyle;          }))          // 4. present alert.         self.presentviewcontroller(alert, animated: true, completion: nil)      } 

it's weird when take out generatetextfield() function performs segue perfectly. i'm confused.

wow, figured out. had instead, segue in body of alert function.

i fixed adding

self.performseguewithidentifier("hairstyle1", sender: self); 

after

hairstyle = tempstyle; line


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -