iOS2012. 9. 12. 16:26


- (void)viewDidLoad{   
      commentTxtView
.text = @"Comment";
      commentTxtView
.textColor = [UIColor lightGrayColor];
}
- (BOOL) textViewShouldBeginEditing:(UITextView *)textView
{
     if(commentTxtView.text.length > 0 && commentTxtView.textColor == [UIColor blackColor])
    	 return YES;
 
     commentTxtView.text = @"";
     commentTxtView
.textColor = [UIColor blackColor];
     
return YES;
}


-(void) textViewDidChange:(UITextView *)textView
{
if(commentTxtView.text.length == 0){
    commentTxtView
.textColor = [UIColor lightGrayColor];
    commentTxtView
.text = @"Comment";
   
[commentTxtView resignFirstResponder];
}
}


Posted by 다오나무