UI实现九宫格界面的搭建(08-03)
- (void)viewDidLoad {
[super viewDidLoad];
for (int i = 0 ; i<5; i++) {
for (int j = 0 ; j<8; j++) {
CGFloat y = self.view.frame.size.height/8;
CGFloat x = self.view.frame.size.width/5;
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x*i, y*j, x, y)];
int r = arc4random() % 256;
int g = arc4random() % 256;
int b = arc4random() % 256;
label.backgroundColor = [UIColor colorWithRed:r / 255.f green:g / 255.f blue:b / 255.f alpha:1.0];
[self.view addSubview:label];
}
}
}
本文标题:UI实现九宫格界面的搭建(08-03)
本文链接:https://www.haomeiwen.com/subject/foqmlxtx.html
网友评论