Ios code creation controls and formatting
1. UIView
The control added to the View is x, and y is calculated from the upper left corner of the View.
2. UIButton
UIButton contains UIlable and UIImageView
SetTitle must be used to set text. titleLabel. text cannot be changed directly because the text status is unknown.
TitleLabel. font when setting the text font
3. NSArray lazy loading
@ Property (nonatomic, strong) NSArray * apps; @ implementation MJViewController-(void) viewDidLoad {[super viewDidLoad]; // Add application information // 0. total number of columns (a maximum of three columns in a row) int totalColumns = 3; // 1. application size CGFloat appW = 85; CGFloat appH = 90; // 2. gap = (Controller view width-3 * Application width)/4 CGFloat marg.pdf = (self. view. frame. size. width-totalColumns * appW)/(totalColumns + 1); CGFloat marginY = 15; // 3. create a box (index 0 ~ 11) for (int index = 0; index