Main content: Label view (Uitabbarcontroller)
First, the use of the scene
Uitabbarcontroller is divided into three levels
Important attributes of Uitabbarcontroller
Property |
Meaning |
Viewcontrollers |
Display View Controller |
TabBar |
tab bar |
Delegate |
Agent |
SelectedIndex |
Select a Tabbaritem |
Second, Uitabbar
1, Tabbar is Uitabbar object contains more than Uitabbaritem,
2, each of the tabbaritem corresponds to a viewcontroller,tabbar height is 49
3, when the Tabbaritem more than 5, the system will automatically add a more button, click More Buttons, the rest of the buttons will not appear at the bottom of the list is displayed in the form of
4, Tabbar properties: Tintcolor, Bartintcolor, image settings
5, Tabbaritem can set tittle, image, Badgevalue
If you want to set all the navigation controller color by one button, similar to the function of one key of QQ, can operate through the Uiappearance protocol, it can make some space to customize color operation, etc.
Third, Block
Block is an anonymous function that implements callback functions for a function, for communication between pages, and for passing values.
Attention:
1, the definition attribute receives block, must use Copy,retain invalid, namely retain and assign will cause the wild pointer question
2, block in a method defined when stored in the stack, in another class using the need to copy, stored in the heap area
3, when the Block is not used to destroy, Block_release ()
4, in the block implementation part, cannot use the instance variable directly, the self calls the property, because the block will cause the self reference count +1, eventually causes the circular reference question
5. All issues to use __block to resolve circular references
Block implementation callback function, clear, simplified code
UI 13th Lesson