YIem`s Blog -心比天高命比纸薄-链接找不到的请在站内搜索内容!

iOS-UI-用for循环铺各色小方块

iOS-UI-用for循环铺各色小方块

for (CGFloat i = 0; i < 375; i+= 75) {
    for (CGFloat j = 0; j < 667; j+=83.375) {
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(i, j, 375 / 5, 83.375)];
        view.backgroundColor = [UIColor colorWithRed:arc4random() % 256 / 255.0 green:arc4random() % 256 / 255.0 blue:arc4random() % 256 / 255.0 alpha:1];
        [self.view addSubview:view];
    }
}

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »