I'm trying to implement the UILongPressGestureRecognizer method, but I'm not sure I have the code implemented correctly. I'm trying to change the colors implemented for a toolbar with a long press.
AwesomeFloatingToolbar.m
- (void) longPress:(UILongPressGestureRecognizer *)recognizer {
if (recognizer.state == UIGestureRecognizerStateBegan) {
for (NSUInteger i = 0; i < [self.colors count] ; i++) {
if (i < 2) {
[self.colors objectAtIndex:i+1];
} else if (i == 2) {
[self.colors objectAtIndex:i+2];
} else if (i == 3) {
[self.colors objectAtIndex:0];
}
}
for (UILabel *thisLabel in self.labels) {
NSUInteger currentLabelIndex = [self.labels indexOfObject:thisLabel];
UIColor *colorForThisLabel = [self.colors objectAtIndex:currentLabelIndex];
thisLabel.backgroundColor = colorForThisLabel ;
}
}
Here is the self.colors
self.currentTitles = titles;
self.colors = [@[[UIColor colorWithRed:199/255.0 green:158/255.0 blue:203/255.0 alpha:1],
[UIColor colorWithRed:255/255.0 green:105/255.0 blue:97/255.0 alpha:1],
[UIColor colorWithRed:222/255.0 green:165/255.0 blue:164/255.0 alpha:1],
[UIColor colorWithRed:255/255.0 green:179/255.0 blue:71/255.0 alpha:1]]mutableCopy];