Swift Xcode 6 If Else statement check letters or numbers -


I am trying to write and if else statement.

I do need to check AtextField is empty or have characters that textfield letter or letters to a UIAlertWIndow runs .

I did Boolean methods no benefit

any idea

what I have written so far:.

  prepareForSegue (segue function override: UIStoryboardSegue, this: AnyObject) {if self.numOfGuestsData.text == "" {alert () println ( "Some Amish") to alertController = UIAlertController (Title : "Partition Bill", Message: "Please enter the number of guests", preferredStyle: UIAlertControllerStyle.Alert alertController.addAction (UIAlertAction (title: "OK", style: UIAlertActionStyle.Default, handler: not equal to)) presentViewController (AlertController, animated: true, completion: zero)} else self.numOfGuestsData.text if! = "" {Go subTotalVC = segue.destinationViewController as subTotalAmountViewController subTotalVC.numOfGuests = numOfGuestsData.text println ( "Everything is right here")}}  

Also, if I alert window Take out and some statement fails for some reason

, so I write it like this:.

  prepareForSegue function overrides (segue: UIStoryboardSegue, this: AnyObject) {if self.numOfGuestsData.text = = "" {alert () println ( "Some Amish")} else if self.numOfGuestsData .text! = "" {Go subTotalVC = segue.destinationViewController as subTotalAmountViewController subTotalVC.numOfGuests = numOfGuestsData.text println ("Everything is OK here")}}  

It just goes to another. ..

are you trying to suppress segue if textField is empty and instead a UIAlertController Is this the case if it exists? Are you using a show Segue? I think your argument is required prepareForSegue: carrying out and should be: PhenformSegueWithIdentifier: . In that method, check your logic for the to prepare Forge: is too late; Surely this is going to happen till then.

In fact, you can override the ProspectusGuideIndidifier: and then either return back to right or your Based on logic. If it gives wrong, then segue will not happen.

Documentation.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -