I asked a question about this earlier ([Stop Segue and show alert partially not working - Xcode](https://stackoverflow.com/questions/31580960/stop-segue-and-show-alert-partially-not-working-xcode/31581239?noredirect=1#comment51117006_31581239))

and received answers that asked me to implement different methods of checking the textfield before segue. However, I realised that something was amiss because one of my IF arguments was being run perfectly fine. 

This is the code:

```
import Foundation
import UIKit
import Darwin

class View3on3 : UIViewController, UITextFieldDelegate {

@IBOutlet weak var APTeams: UITextField!
@IBOutlet weak var APRounds: UITextField!
@IBOutlet weak var APBreakers: UITextField!

override func viewDidLoad()
{
    super.viewDidLoad()
    initializeTextFields()
}

func initializeTextFields()
{
    APTeams.delegate = self
    APTeams.keyboardType = UIKeyboardType.NumberPad

    APRounds.delegate = self
    APRounds.keyboardType = UIKeyboardType.NumberPad

    APBreakers.delegate = self
    APBreakers.keyboardType = UIKeyboardType.NumberPad
}

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?){
    view.endEditing(true)
    super.touchesBegan(touches, withEvent: event)
}

    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

        if (APTeams.text!.isEmpty || APRounds.text!.isEmpty || APBreakers.text!.isEmpty)
        {
            let alertController: UIAlertController = UIAlertController(
                title: "Data missing!",
                message: "Please enter valid data into all 3 fields.",
                preferredStyle: UIAlertControllerStyle.Alert)

            let okAction = UIAlertAction(
                title: "OK",
                style: UIAlertActionStyle.Default,
                handler: nil)

            alertController.addAction(okAction)

            presentViewController(alertController, animated: true, completion: nil)
        }

        else if (Int(String(APTeams.text)) < Int(String(APBreakers.text)))
        {
            let alertController: UIAlertController = UIAlertController(
                title: "Math Error!",
                message: "The number of breaking teams cannot be more than the number of teams.",
                preferredStyle: UIAlertControllerStyle.Alert)

            let okAction = UIAlertAction(
                title: "OK",
                style: UIAlertActionStyle.Default,
                handler: nil)

            alertController.addAction(okAction)

            presentViewController(alertController, animated: true, completion: nil)
        }

        else if (Int(String(APTeams.text)) > 9999)
        {
            let alertController: UIAlertController = UIAlertController(
                title: "Math Error!",
                message: "The number of breaking teams cannot be more than the number of teams.",
                preferredStyle: UIAlertControllerStyle.Alert)

            let okAction = UIAlertAction(
                title: "OK",
                style: UIAlertActionStyle.Default,
                handler: nil)

            alertController.addAction(okAction)

            presentViewController(alertController, animated: true, completion: nil)
        }

        else
        {
            let DestViewController : View3on3Results = segue.destinationViewController as! View3on3Results

            DestViewController.AP1 = APTeams.text!
            DestViewController.AP2 = APRounds.text!
            DestViewController.AP3 = APBreakers.text!

        } 
        }
}

```

It's running the textfield input through the first IF function perfectly fine. Screenshots here:

[![enter image description here](https://i.stack.imgur.com/w4Dw3.png)](https://i.stack.imgur.com/w4Dw3.png)[![enter image description here](https://i.stack.imgur.com/M2E4j.png)](https://i.stack.imgur.com/M2E4j.png)

but when I key this in (which should fulfil the first ELSE IF function and show an alert:

[![enter image description here](https://i.stack.imgur.com/Go8M9.png)](https://i.stack.imgur.com/Go8M9.png)

It just segues as normal.

Why is this happening? Help much appreciated. =)