2011-03-08 2 views

답변

4

이것은 매우 간단합니다. 셀에 배경색이없는 UITextField을 추가하기 만하면됩니다. cellForRowAtIndexPath 메소드에 아래 코드를 추가하십시오.

UITextField *inputText = [[UITextField alloc]initWithFrame:CGRectMake(10,10,280,22)]; 
inputText.textAlignment = UITextAlignmentLeft; 
inputText.backgroundColor = [UIColor clearColor]; 
inputText.placeHolder = @"Street"; 
[cell.contentView addSubview:inputText]; 
[inputText release]; 
+0

MonoTouch 솔루션을 찾고 있습니다. 그래도 고마워. –

+0

답변을 통해 내 솔루션을 얻을 수있었습니다. 감사. –

+4

@Brian David Berman : 환영합니다 ..하지만 당신이 한 일을 정확히하려는 다른 사람들을 도울 수 있도록 여기에 답을 게시하십시오 (새로운 답). – EmptyStack

1

셀은 맞춤 셀입니다. 여기에는 몇 가지 속성, 편집 가능한 UITextField 및 빈 내용에 대한 자리 표시 자 문자열이 있습니다. 다음 코드는 손으로 쓴 것이므로 내부에 버그가있을 수 있습니다.

@interface EditableCell : UITableViewCell { 
    UITextField *mTextField; 
} 
@property UITextField *textField; 

- (void)setPlaceHoldString:(NSString *)placeHolder; 
@end 

@implement EditableCell 
@synthesize textField = mTextField; 

- (void)setPlaceHoldString:(NSString *)placeHolder 
{ 
    self.textField.placeHolder = placeHolder; 
} 

- (UITextField *)textField 
{ 
    if (mTextField == nil) { 
     mTextField = [[UITextField alloc] init]; 

     // Configure this text field. 
     ... 

     [self addSubView:mTextField]; 
    } 

    return mTextField; 
} 

- (void)dealloc 
{ 
    self.textField = nil; 
    [super dealloc]; 
} 
@end 
+0

감사의 답변을 전했지만 MonoTouch 버전을 찾고있었습니다. 나는 당신의 응답에서 나의 해결책을 그러나 시도하고 파생 할 것이다. –

+0

아, 죄송합니다. 태그에 iPhone이있는 것을 확인했습니다. – AechoLiu

관련 문제