iOS Programming: The Big Nerd Ranch Guide (5th Edition) (Big Nerd Ranch Guides)
Christian Keur, Aaron Hillegass
Format: PDF / Kindle (mobi) / ePub
iOS Programming: The Big Nerd Ranch Guide leads you through the essential concepts, tools, and techniques for developing iOS applications. After completing this book, you will have the know-how and the confidence you need to tackle iOS projects of your own. Based on Big Nerd Ranch's popular iOS Bootcamp course and its well-tested materials and methodology, this bestselling guide teaches iOS concepts and coding in tandem. The result is instruction that is relevant and useful.
Throughout the book, the authors explain what's important and share their insights into the larger context of the iOS platform. You get a real understanding of how iOS development works, the many features that are available, and when and where to apply what you've learned.
When a UIButton is tapped, it calls a method on another object. That object is called the target. The method that is triggered is called the action. This action is the name of the method that contains the code to be executed in response to the button being tapped. In your application, the target for both buttons will be the instance of ViewController. Each button will have its own action. Let’s start by defining the two action methods: showNextQuestion(_:) and showAnswer(_:).
reading2 = 9.2 9.2 reading3 = 9.7 9.7 However, you cannot use these optional floats like non-optional floats – even if they have been assigned Float values. Before you can read the value of an optional variable, you
let secondFrame = CGRect(x: 20, y: 30, width: 50, height: 50) let secondView = UIView(frame: secondFrame) secondView.backgroundColor = UIColor.greenColor() view.addSubview(secondView) } Build and run again. In addition to the blue rectangle, you will see a green square near the
secondView.backgroundColor = UIColor.greenColor() firstView.addSubview(secondView) } Now let’s add some views to the interface and set their frames. Open Main.storyboard. Notice that the interface on the screen is currently a square. While you explore views and their frames, it will be nice to have the size of the interface in Xcode match the screen size of the device that you will be using.
storyboard file, and you need a way of triggering the dismissKeyboard(_:) method you added. To take care of the first item, open Main.storyboard and select the Conversion View Controller. Control-drag from the Conversion View Controller to the text field on the canvas and connect it to the textField outlet. Now you need a way of triggering the method you implemented. You will use a gesture recognizer to accomplish this.