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
@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
相关文章推荐
- DuiLib(7)——CTreeViewUI使用攻略
- requirejs加载css
- 79.iOS 设备的UI规范和iOS各控件默认高度
- 通用页面框架CmPage(一):简介
- [leetcode] 23. Merge k Sorted Lists
- EasyUI 使用心得
- Android gradle plugin和 Gradle版本关系\Gradle version 1.10 is required. Current version is 2.0
- Audio Session Programming Guide(官方文档翻译一)
- 深度评测xcgui(二)
- KVC中setValuesForKeysWithDictionary:
- iOS - UITextFieldKeyBoardPan为时间选择器
- 深入了解Volley如何执行一个Request的流程
- UE3 ExampleGame Android版无法运行解决方案
- 菜鸟成长记-QQ聊天输入框随键盘弹起、UITableView加强
- 【LeetCode】51. N-Queens
- Android UI界面开发基础归纳
- UIImage加载方式
- UINavigationBar
- 深度评测xcgui(一)
- 解决UIScrollview无故偏移和导航条遮挡view的问题