2011-10-23 8 views

答えて

2

サブクラスのUITableViewCellとセルのcontentViewにするUITextFieldを追加します。おそらく、独自のtableViewCellを作成せずに結果を得ることはできません。

例:

MyAwesomeTextfieldCell.h

@interface MyAwesomeTextfieldCell : UITableViewCell 
@property (retain, nonatomic) IBOutlet UITextField *labelTextView; 
@end 

MyAwesomeTextfieldCell.m

- (id)initWithFrame:(CGRect)frame { 
    self = [super initWithFrame:frame]; 
    if (self) { 
     _labelTextView = [[UITextField alloc] init]; 
     _labelTextView.backgroundColor = [UIColor clearColor]; 
     _labelTextView.font = [UIFont boldSystemFontOfSize:17.0]; 
     _labelTextView.textColor = [UIColor whiteColor]; 
     [self addSubview:_labelTextView]; 
    } 
    return self; 
} 
+0

私は、プログラムのUITableViewCellのようにUITextFieldの作成方法を言うことだろうか、Interface Builderを使用して申し訳ありませんが? – User

+0

私の例を見てください。それはプログラムでそれを行う方法です。もちろん、Interface Builderで行うこともできます。カスタムクラスにペン先を追加するだけです。 –

0
static NSString * kCellReuse = @"CellReuseIdentifier" 
UITableViewCell * cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCellReuse]; 
関連する問題