Target
IOS interface development tool-InterfaceBuilder
Create a view
Understanding how to create buttons, text boxes, and images using InterfaceBuilder
Understand how Code creates a button
1. IOS interface development tool-InterfaceBuilder
Introduction
IB for short
Used to build a graphical interface (WYSIWYG)
Early use of OpenSTEP and NextSTEP
Toolbox, including common interface elements
Toolbox scalability
Nib file
Interface Configuration File
The old format. nib and the new format. xib
Unified use of the apple documentation. nib
Nib file structure
File 'sowner
Nib file owner
Load nib files from disk
FirstResponder
Objects currently interacting
Changes with the interaction between the user and the interface
Objects
Show user interface
Complete User Interaction
Is a UIView class or its subclass
XCode file directory structure
Classes
Store source code files
Create group organization code
Other Sources
*. Pch File
Pre-compiled header files
Header files from external frameworks used in the project
Used to improve efficiency
Main. m file
Program entry file
Resources
Non-code part of the application, including files such as multimedia and text
HelloWorld-Info.plist
Application property list
MainWindow. xib
Contains the information required by the Interface Builder to build a window
HelloWorldViewController. xib
Contains the information required by the Interface Builder to build a view.
Frameworks
A special library
Will be linked to the program
You can use classes in the library
Products
Include files generated after project Compilation
2. Create a view
General steps
Design Interface, add required controls from the library
Add the corresponding IBOutlet variable and IBAction Method to the code.
Connect the control to the corresponding variable
Connection behavior to the corresponding method
MVC in IOS.
View: The interface generated by the LLLViewController. xib file. Pure Interface
Controller: controlled by the LLLViewController. h.m file written in code
Pure code
Currently, there is a controller class LLLViewController. h LLViewController. m
Multiple view files are available: LLViewController. xib testView. xib xxx. xib
File's Owner
(1) Each xib File comes with a File 'owner placeholder
(2) click the File 'owner of the xib File, and then open the third panel on the right (ID checker)
You can specify the Controller Class in Custom Class to control the xib.
(3) LLViewController. xib File. The default File's Owner is LLViewController. m.
You can also delete it and specify the class as LLLViewController. m in the File's Owner of textView. xib or xxx. xib.
(4) in a project, a controller can only control (own) One xib file. If the File's Owner of the three xib files is specified as a controller, an error occurs.
(5) Conclusion: MVC in iOS is a View corresponding to a Controller, and two files are associated through the File's Owner.
3. Use InterfaceBuilder to create buttons, text boxes, and images
4. Understand the principle and code of using code to create a button
Job:
Functional requirements: calculator Project
(1) Use IB to complete the project interface (customized style)
(2) You can click the number button to display the displayed number.
(3) Implement the calculator computing Function
(4) computing result output
Logo
Menu1
Menu2
Menu3
Menu4
Menu5