Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Weather App with Swift (Retired) Displaying Our Weather Data Handling Failures

Eliot Murton
Eliot Murton
7,315 Points

Cancel and OK buttons are wrong way round. Why?

When the alert box pops up, "Cancel" is on the left and "OK" is on the right. Why is this? I swapped their places in the code but this does not change anything. I have no idea why.

2 Answers

Nick Jones
Nick Jones
2,086 Points

Hi Elliot

When you say you changed it in the code would you be able to post said code for me? I can then take a look and get a better idea of what's going on for you.

Eliot Murton
Eliot Murton
7,315 Points
    })
            // V.Handling Failures
            } else {
                // View Controller
                let networkIssueController = UIAlertController(title: "Error", message: "Unable to load data. Connectivity error!", preferredStyle: .Alert)

                // OK Button
                let okButton = UIAlertAction(title: "OK", style: .Default, handler: nil)
                networkIssueController.addAction(okButton)

                // Cancel Button
                let cancelButton = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)
                networkIssueController.addAction(cancelButton)





                self.presentViewController(networkIssueController, animated: true, completion: nil)

                dispatch_async(dispatch_get_main_queue(), { () -> Void in
                    // Stop refresh Animation
                    self.refreshActivityIndicator.stopAnimating()
                    self.refreshActivityIndicator.hidden = true
                    self.refreshButton.hidden = false