'TextView'에 해당되는 글 1건

  1. 2012.09.12 [IPhone] UITextView를 UITextField의 placeholder 처럼 사용하기
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 다오나무