2011-06-28 10 views
2

テーブルセルにテキストフィールドを追加しようとしています。誰もがこの例では、このコードテーブルセルにテキストフィールドを追加する

aCell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"UserIDCell"] autorelease]; 
        aCell.textLabel.text = @"User Name"; 
        aCell.selectionStyle = UITableViewCellSelectionStyleNone; 
        UITextField *user_ID_TextField1 = [[UITextField alloc] initWithFrame:CGRectZero]; 
        aCell.accessoryView = user_ID_TextField1; 
        [user_ID_TextField1 release]; 

おかげ

答えて

4

ルックを修正してくださいすることができます。

UITextField *textField = [[UITextField alloc]initWithFrame:CGRectMake(110, 10, 185, 30)]; 
    textField.clearsOnBeginEditing = NO; 
    textField.textAlignment = UITextAlignmentRight; 
    textField.delegate = self; 
    [aCell.contentView addSubview:textField]; 

ヘッダーファイルにUITextFieldDelegateを追加することを忘れないでください。

+0

ありがとうございました。 – pa12

関連する問題