는 "성"나는 이러한 작업을 구현하려는은 UITextView (아이폰)에서이 작업을 수행하는 방법에 내 텍스트 뷰에서
.. 기본값이
1)이 표시되어야입니다 필드가 여전히 만약 내가 내 편집을 완료입니다 "이름"먼저
2) 나는 그것이
3 전무가되었다한다 편집을 시작) 후 다시 "이름"
수로 표시한다 NIL 누구든지 이걸 도와 줘?
// *이것은 내가 지금 뭐하는 거지 지금** //
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range
replacementText:(NSString *)text
{
if ([email protected]"") {
[email protected]"First Name(Required)";
}
// Any new character added is passed in as the "text" parameter
if ([text isEqualToString:@"\n"]) {
// Be sure to test for equality using the "isEqualToString" message
[textView resignFirstResponder];
// Return FALSE so that the final '\n' character doesn't get added
return FALSE;
}
// For any other character return TRUE so that the text gets added to the view
return TRUE;
return TRUE;
}
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView {
NSLog(@"textViewShouldBeginEditing");
textView.scrollEnabled=NO;
if (textView == first_name) {
first_name.text=nil;
}
return YES;
}
UITextField를 의미합니까? placeHolder라는 속성이 있습니다. –
아니요 textView .... –
esqew가 아래에 언급했듯이 대리자 메서드를 사용하십시오 textViewDidStart/End-Editing –