Created
November 7, 2015 05:11
-
-
Save warriorg/bfcb94685218b13f89b3 to your computer and use it in GitHub Desktop.
UIView 增加触摸效果
This file contains 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
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
[super touchesBegan:touches withEvent:event]; | |
[self setBackgroundColor:[UIColor colorWithRed:227/255.0 green:227/255.0 blue:227/255.0 alpha:1.0]]; | |
} | |
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { | |
[super touchesEnded:touches withEvent:event]; | |
[self setBackgroundColor:[UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0]]; | |
} | |
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { | |
[super touchesCancelled:touches withEvent:event]; | |
[self setBackgroundColor:[UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0]]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment