Last active
August 29, 2015 13:56
-
-
Save langford/9008754 to your computer and use it in GitHub Desktop.
Cause IBOutletCollectionss are useful, but painful and ill supported by IB. You will want this code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSArray*)sortArrayByY:(NSArray*)array{ | |
return [array sortedArrayUsingComparator:^NSComparisonResult(id label1, id label2) { | |
if ([label1 frame].origin.y < [label2 frame].origin.y) return NSOrderedAscending; | |
else if ([label1 frame].origin.y > [label2 frame].origin.y) return NSOrderedDescending; | |
else return NSOrderedSame; | |
}]; | |
} | |
- (void)clearTextInArray:(NSArray*)array{ | |
for (UILabel* label in array){ | |
label.userInteractionEnabled = NO; | |
label.textColor = [UIColor blackColor]; | |
label.text = @""; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment