In Objective-C Check an array of Boolean Values and see if at least ONE is YES
问题 I have a mutable array of Boolean values and I want to check to see if ANY of the values are YES. At present I am creating another array alongside this one which is always ALL False like so; [MyArray addObject:[NSNumber numberWithBool:switchInput]]; [MyAllNoArray addObject:[NSNumber numberWithBool:NO]]; The user does some bits and the some of the objects in MyArray may become YES, I then use the below to see if ANY are true or not. if([MyArray isEqualToArray:MyAllNoArray]) I am just wondering