[self.redArray removeAllObjects];
[self.blueArray removeAllObjects];
for (int i=0; i<5; i++) {
int redCode= 1+(arc4random() % 35);
for (int j=0; j<self.redArray.count; j++) {
NSString *s=self.redArray[j];
while (s.intValue==redCode) {
redCode = 1+(arc4random() % 35);
j = -1;
}
}
[self.redArray addObject:[NSString stringWithFormat:@"%d",redCode]];
}
for (int i=0; i<2; i++) {
int blueCode=1 +(arc4random() % 12);
for (int j=0; j<self.blueArray.count; j++) {
NSString *s=self.blueArray[j];
while (s.intValue==blueCode) {
blueCode = 1+(arc4random() % 12);
j = -1;
}
}
[self.blueArray addObject:[NSString stringWithFormat:@"%d",blueCode]];
}
IWLog(@"蓝球号码为%@",self.blueArray);
if (_normalThrowBtn.selected) {
for (UIView *view in _normalScrollView.subviews) {
if ([view isKindOfClass:[UIButton class]]) {
UIButton *button=(UIButton*)view;
if (![button isEqual:self.randomSelectBtn]) {
button.backgroundColor=[UIColor whiteColor];
button.selected=NO;
for (int i=0; i<5; i++) {
NSString *redCodeStr=self.redArray[i];
if ((button.tag-500)==redCodeStr.integerValue) {
button.selected=YES;
button.backgroundColor=RGBACOLOR(229, 34, 34, 1.0);
}
}
for (int i=0; i<2; i++) {
NSString *blueCodeStr=self.blueArray[i];
if ((button.tag-1000)==blueCodeStr.integerValue) {
button.selected=YES;
button.backgroundColor=RGBACOLOR(69, 96, 229, 1.0);
}
}
}
}
}
}