急!急!急!要做舒尔特方格,怎么让生成随机数显示在button上呢
xcode吧
全部回复
仅看楼主
level 1
CIELSLOVE 楼主
2015年04月18日 03点04分 1
level 3
UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
NSInteger num = arc4random()%101;//生成0~100之间的随机数,可重复
NSString * numStrig = [NSString stringWithFormat:@"%ld",num];
[btn setTitle:numStrig forState:UIControlStateNormal];
将0 ~ 100之间的随机数随机加到btn的title上。btn的布局和frame自己设置,如果不要重复随机数你可以坐一下判定。
2015年04月23日 04点04分 2
谢谢[真棒]
2015年04月27日 10点04分
1