我需要经过几个控制段,确保在进入下一个视图前点击了所有项。什么方式来检查outletcollection中的所有项目的值
到目前为止,我有这样的:
-(void)checkAllSegments
{ BOOL alertShown;
alertShown = NO;
for (UISegmentedControl *swItem in allSegmentControlOutlet) {
int selectedSegment = swItem.selectedSegmentIndex;
swItem.segmentedControlStyle = UISegmentedControlStyleBar;
//didPass = YES;
if (selectedSegment == -1) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Fill in all forms"
message:@"Please go back and fill in missing info"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
// [swItem setTintColor:[UIColor redColor]];
if (!alertShown) {
[alert show];
alertShown = YES;
didPass = NO;
return;
}
}
}
if (didPass) {
[self performSegueWithIdentifier:@"ToHiring" sender:self];
}
}
的问题是我不知道从哪里把didPass = YES;
,因为它被注释掉它种工作,除非在循环的最后一个项目被填满。或者,也许有更好的方法来检查我不知道的集合中的所有值。
嗯,似乎工作,我本可以发誓,我试过了,感谢简单的答案! :) – BluGeni