IOS UI basics 01 and iosui01
Controller
- 1. What is a controller? Any class inherited from UIViewController is called a controller.
- 2. Role of the Controller: Manage the UI interface (responsible for managing the creation of the UI interface and handling of some events)
IBAction
- Connection Mode
- 1. Connect from "controller" to "Storyboard"
- 2. Connect from "Storyboard" to "controller"
- 3. connect directly to the top of the "Storyboard" Interface
- 4. Connect the toolbar directly to the Storyboard in "Storyboard ".
- 5. You do not need to define a method to connect directly from "Storyboard" to "controller ".
- Notes for connecting IBAction lines
- 1. Notes When copying elements in Storyboard
- 2. The previous connections will be copied together during the copy operation.
- 3. One method can associate multiple controls
- 4. A control can be connected to many methods in development. Generally, it is not written in this way.
- 5. If you delete the method associated with the button, a classic error reason: '-[ViewController redBtnClick]: unrecognized selector sent to instance 0x7fb4aa618e50' will be reported after the operation'
- 6. IBAction can only be returned as a method. IBAction = viod
UI widget size
- Most UI controls do not have the default size, so UIButton is invisible.
- Frame
- Bounds
- Center
- ViewWithTag
- ViewWithTag can only find the current control and the Child control of the current control. It cannot find the sibling control or the parent control.
- Search order: 1. First find yourself 2. Find child Control 3. Find indirect child control (Sun Tzu ..)
- Obtain the value of the corresponding tag using the tag
- Anonymous Classification
- Differences between anonymous and Classification
- 1. The anonymous category has no name, and the category has a name.
- 2. The implementation of anonymous classification is not required, but the implementation of classification is required.
- 3. for anonymous classification, you can declare attributes or methods. For classification, you can only declare methods.
- Notes
- Attributes and methods that are being developed but do not need to be exposed to the outside world will be uninstalled from the anonymous category.
- We recommend that you write attributes in anonymous categories (extension/class extension)