标签:
来蓝懿教育学习的第一天,由刘国斌老师独家授课教学,一天下来感觉很充实,并且在没有任何基础之上学到如何在Xcode中运用简单的数字运算与图形关联方法。刘老师教课方式比较有趣生动,班级很活跃,我们这一批学员人数较少,所以学习气氛浓郁,把今天的笔记整理一下。
————————————首先是简单数字运用计算———————————————
?
?
int c =1231233123;
float a = 10;
float b = 232.23;
float d = a-b-c;
NSLog(@"%f",d);
UILabel *v = [[UILabel alloc]initWithFrame:CGRectMake(100 , 100,100,100)];
v.text = [NSString stringWithFormat:@"%f",d];
[self.view addSubview:v];
————————————————以及随机值的运用?———————————————
?
?int x = 5;
int y =10;
NSLog(@"%d",x+y);
//随机值
//int o = arc4random()%6; 6是范围
UILabel *l = [[UILabelalloc]initWithFrame:CGRectMake(arc4random()%(320-40), arc4random()%(568-60),40, 60)];
l.backgroundColor = [UIColor blueColor];
l.text = @"aaa";
[self.view addSubview:l];
UILabel *h = [[UILabelalloc]initWithFrame:CGRectMake(arc4random()%(320-40), arc4random()%(568-50), 40, 50)];
h.text = @"4";
h.backgroundColor = [UIColor redColor];
[self.view addSubview:h];
————————————还有图形关联————————————
[super viewDidLoad];
_shang.text = @"上";
_zuo.text = @"左";
_xia.text = @"下";
_you.text = @"右";
_zhong.text = @"中";
[self.view addSubview:_shang];
蓝懿 2015 IOS 学习笔记 数字运算 随机值 图形关联
标签:
原文地址:http://www.cnblogs.com/lovemyios/p/4803767.html