1.UIView
在View裡面添加的控件是x,y是以View的左上角開始算
2.UIButton
UIButton 裡面包含UIlable 和 UIImageView
設置text時要用setTitle ,不能直接改 titleLabel.text 因為不知道text的狀態
設置text字體時titleLabel.font
3. NSArray 懶加載
@property (nonatomic, strong) NSArray *apps;
@implementation MJViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// 添加應用信息
// 0.總列數(一行最多3列)
int totalColumns = 3;
// 1.應用的尺寸
CGFloat appW = 85;
CGFloat appH = 90;
// 2.間隙 = (控制器view的寬度 - 3 * 應用寬度) / 4
CGFloat marginX = (self.view.frame.size.width - totalColumns * appW) / (totalColumns + 1);
CGFloat marginY = 15;
// 3.根據應用個數創建對應的框框(index 0 ~ 11)
for (int index = 0; index