The interface of IOS is divided into status bar, navigation bar, main interface and bottom status bar.
This article describes the relative level of the main interface uiview layout, and the use of block syntax, the operation of the other three, in other articles.
Basic definition of block block block:
@interface UIView (STUIViewEvent) typedef void(^ViewDescription)(id view); #Pragma mark added description //! provide a code block to facilitate the description of code block in code specification description -(UIView*)block:(NSString*)description on:(ViewDescription)descBlock; @end
The definition of block can be used to describe the function description of a group of UI, and also can be used to write the layout of UI.
Through the block writing method, the layout code is more hierarchical
1. Example code:
After adding a uiview, through block, you can continue to append attribute control, or you can add subviews in the.
The on parameter of block block block is ID by default, which can be modified to the specific uiview type (such as uibutton and uilabel)