I am create label and button programatically . My concerned is on longPress gesture it color change .its work fine. And when user tap on another previous button and label color became clear. My button work fine but my previous label not clear Color.
- (void)handleLongPress :(UITapGestureRecognizer *)gestureRecognizer
{
if (gestureRecognizer.state == UIGestureRecognizerStateEnded) {
NSLog(@"Long press Ended");
appDelegate.selectedTag =gestureRecognizer.view.tag;
} else if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
UILabel *previousLabel = (UILabel *)[self.view viewWithTag:appDelegate.selectedTag];
NSLog(@"%@",previousLabel);
previousLabel.backgroundColor =[UIColor clearColor];
UIButton *button = (UIButton *)[self.view viewWithTag:gestureRecognizer.view.tag];
button.backgroundColor =[UIColor colorWithRed:0.102 green:0.776 blue:0.557 alpha:1];
UILabel *label=(UILabel *)gestureRecognizer.view;
label.backgroundColor=[UIColor colorWithRed:0.102 green:0.776 blue:0.557 alpha:1];
UIButton *previousbutton = (UIButton *)[self.view viewWithTag:appDelegate.selectedTag];
previousbutton.backgroundColor =[UIColor clearColor];
}
}
0 comments:
Post a Comment