-
-
Save syxc/4316230 to your computer and use it in GitHub Desktop.
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
| - (void) viewDidLoad { | |
| //... | |
| comments.text = @"Comments"; | |
| comments.textColor = [UIColor lightGrayColor]; | |
| isEmpty = YES; | |
| //... | |
| } | |
| - (BOOL)textViewShouldBeginEditing:(UITextView*)textView { | |
| if (isEmpty) { | |
| comments.text = @""; | |
| comments.textColor = [UIColor blackColor]; | |
| isEmpty = NO; | |
| } | |
| return YES; | |
| } | |
| - (void) textViewDidEndEditing:(UITextView*)textView { | |
| if(comments.text.length == 0){ | |
| comments.textColor = [UIColor lightGrayColor]; | |
| comments.text = @"Comments"; | |
| isEmpty = YES; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Android中的hint属性,iOS中的placeholder属性!!!