您的位置:首页 > 产品设计 > UI/UE

UIColor *_color[5] UIColor数组

2016-04-07 18:07 537 查看
#import "ViewController.h"

@interface ViewController (){

UIColor *_color[5];

}

@end

@implementation ViewController

- (void)viewDidLoad {

[super viewDidLoad];

_color[0] = [UIColor redColor];

_color[1] = [UIColor blueColor];

_color[2] = [UIColor greenColor];

_color[3] = [UIColor cyanColor];

_color[4] = [UIColor yellowColor];

NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(change) userInfo:nil repeats:YES];

[timer fire];

}

- (void)change{

int x = arc4random() % 5;

self.view.backgroundColor = _color[x];

}

@end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: