Preparation of Knowledge:
A. Storyboard file
1. Before iOS5, Apple uses the Xib file to describe the UI interface
2. After iOS5, Apple has taken a more powerful and advanced storyboard file to describe the interface (XCODE5 is iOS7 based)
3. The arrow on the left indicates that the interface indicated by the arrow is displayed when the program starts
II: UIView (IMPORTANT)
1. What can be seen and touched on the screen is UIView, such as buttons on the screen, text, pictures
2. General translation is called: View \ Controls \ Components
3.UIButton, UILabel, Uitextfield all inherit from UIView
4. Each uiview is a container that can accommodate other uiview (for example, the entire keyboard on the right is a uiview, which holds a number of small squares uiview)
Three: Uiviewcontroller (important)
1. In fact, whenever a new interface is displayed, a new Uiviewcontroller object is created first, and then a corresponding full-screen Uiview,uiviewcontroller is created to manage this UIView
2.UIViewController is UIView's big Butler, responsible for creating, displaying, destroying uiview, monitoring events within UIView, and handling UIView interactions with users.
There is a UIView property inside the 3.UIViewController, which is the UIView object it is responsible for managing:
@property (Nonatomic,retain) UIView *view;
Start the program:
1. Ideas
Read Main.storyboard file
Create the Mjviewcontroller object that the arrow refers to
Create Mjviewcontroller UIView objects as described in the storyboard file
Display the UIView object in front of the user
The click of the "Calculate" button is monitored by Mjviewcontroller.
Precautions (to prevent forgetting)
1.IBAction:
1> can guarantee that the method can be wired
2> equivalent to void
2.IBOutlet:
1> can ensure that attributes can be wired
3. Common errors
Setvalue:forundefinedkey:]: This class was not key value coding
The reason for the error is: the connection problem
Some suggestions for 4.XCODE5 start
Declare some methods and properties for wiring in the class extension of the. m file
5.frame\center\bounds
1> frame: Can modify position and size
2> Center: Can modify position
3> bounds: Can modify the size (X\y is generally 0)
First iOS Program--Addition calculator