Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 476 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
476
Dung lượng
20,5 MB
Nội dung
[...]... object when it is activated So the control needs answers to two questions: what’s the action and who’s the target? An action is the name of the method that is triggered by a control The target is the object that is sent the message In the case of the Show Question button, the button is activated when the user touches it The action the touch triggers is showQuestion:, and the target is QuizAppDelegate... close the window and fear that they have deleted it.) From the Library, drag two instances of UILabel onto the window Make the labels nearly as wide as the window (Figure 1.5) Then, drag two instances of UIButton onto the window You can change the text an object displays by double-clicking it Set the text for one button to Show Question and the other to Show Answer Page 6 Chapter 1 A Simple iPhone. .. the curly braces, and methods are declared after the closing curly brace Save QuizAppDelegate.h Making Connections The views and the controller object that your application needs have been created, but they know nothing about each other Now you’re going to introduce them to each other by making these connections: • The controller object has two pointers that need to point to the UILabel objects • The. .. and labels to the window Objects have instance variables, and many of these can be set in the Inspector As an example, you are going to center the text in the UILabel objects Select a UILabel In the Attributes panel of the Inspector, you will see the options for Alignment (Figure 1.6) Select the option that centers the text Page 7 Chapter 1 A Simple iPhone Application Figure 1.6 Centering the label text... screen icon.) Figure 1.15 The Info Property List Page 23 Chapter 1 A Simple iPhone Application Build and run your application again The BigNerdRanch logo will appear as the icon for Quiz Default Images When launching an application, the code and resources (like MainWindow.xib) need to be loaded into memory This takes time, and in the meantime all the user sees is a black screen TheiPhone is intended to... “When the user presses the button, I want this piece of code to be executed.”) Most of this book is dedicated to answering these questions When an iPhone application starts, it puts a window on the screen You can think of the window as the canvas on which everything else appears: buttons, labels, etc Anything that can appear on the window is a view TheiPhone SDK is an object-oriented library, and the. .. create new instances in your XIB file You use the Inspector to “inspect” and edit the configuration of objects in the XIB file The Inspector has four panels: Attributes, Connections, Size, and Info represented by the icons at the top of the frame You’ll be using the Attributes and the Connections panels in this chapter In the doc window, double-click on the UIWindow object to make it appear fullsized... on the App Store Application identifiers typically look like this: com bignerdranch.AwesomeApp, where the name of the application follows the name of your company The App ID in your provisioning profile must match the bundle identifier of your application A development profile, like you just created, can have a wildcard character for its App ID and therefore will match any Bundle Identifier To see the. .. Chapter 1 A Simple iPhone Application Resources group in the project window There are a couple of options for the application icon that can be set in Quiz-Info plist also located in the Resources group If you want to use an icon filename other than the default Icon.png, you can set the value of the Icon file key within this file Also, if you don’t want the glossy effect added to the application icon,... label text Now center the text in the other label Model-View-Controller You will hear iPhone programmers speak of the “Model-View-Controller pattern.” What that means is every object you create will be exactly one of the following: a model object, a view object, or a controller object View objects are visible to the user; the button, the label, and the window are all view objects The views are often . x0 y0 w1 h1" alt=""
iPhone Programming
The Big Nerd Ranch Guide
Joe Conway
Aaron Hillegass
iPhone Programming: The Big Nerd Ranch Guide
by Joe Conway and. contact
Big Nerd Ranch, Inc.
1963 Hosea L. Williams Drive SE
Suite 209
Atlanta, GA 30317
(404) 478-9005
http://www.bignerdranch.com/
book-comments@bignerdranch.com
The