Is there any way to simplify this method? Perhaps a way to && both statements together in one for- loop?
// Enable valid decimal buttons
- (IBAction)enableDecimalValues
{
for(UIButton *decimalButton in nonOctalValueCollection)
{
decimalButton.enabled = YES;
[decimalButton setAlpha:1];
}
for(UIButton *decimalButton in nonBinaryValueCollection)
{
decimalButton.enabled = YES;
[decimalButton setAlpha:1];
}
}
There is nothing “wrong” with your code, per se. What you have here is clarity; a reader can quickly see and understand what is happening.
Alternatives require allocating memory and copying objects, just so you can have 1 loop. But in the end, the performance is worse (strictly speaking).
But, if you insist, how about this:
(Leave off the
autoreleaseif you’re using ARC.)