继UITableViewCell 重- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier
2009-05-25 20:53
411 查看
@interface DetailCell : UITableViewCell {
UITextField *type;
UITextField *name;
UITextField *prompt;
BOOL promptMode;
}
- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) {
// Initialize the labels, their fonts, colors, alignment, and background color.
type = [[UILabel alloc] initWithFrame:CGRectZero];
type.font = [UIFont boldSystemFontOfSize:12];
type.textColor = [UIColor darkGrayColor];
type.textAlignment = UITextAlignmentRight;
type.backgroundColor = [UIColor clearColor];
name = [[UILabel alloc] initWithFrame:CGRectZero];
name.font = [UIFont boldSystemFontOfSize:14];
name.backgroundColor = [UIColor clearColor];
prompt = [[UILabel alloc] initWithFrame:CGRectZero];
prompt.font = [UIFont boldSystemFontOfSize:12];
prompt.textColor = [UIColor darkGrayColor];
prompt.backgroundColor = [UIColor clearColor];
// Add the labels to the content view of the cell.
// Important: although UITableViewCell inherits from UIView, you should add subviews to its content view
// rather than directly to the cell so that they will be positioned appropriately as the cell transitions
// into and out of editing mode.
[self.contentView addSubview:type];
[self.contentView addSubview:name];
[self.contentView addSubview:prompt];
// self.autoresizesSubviews = YES;
}
return self;
}
UITextField *type;
UITextField *name;
UITextField *prompt;
BOOL promptMode;
}
- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) {
// Initialize the labels, their fonts, colors, alignment, and background color.
type = [[UILabel alloc] initWithFrame:CGRectZero];
type.font = [UIFont boldSystemFontOfSize:12];
type.textColor = [UIColor darkGrayColor];
type.textAlignment = UITextAlignmentRight;
type.backgroundColor = [UIColor clearColor];
name = [[UILabel alloc] initWithFrame:CGRectZero];
name.font = [UIFont boldSystemFontOfSize:14];
name.backgroundColor = [UIColor clearColor];
prompt = [[UILabel alloc] initWithFrame:CGRectZero];
prompt.font = [UIFont boldSystemFontOfSize:12];
prompt.textColor = [UIColor darkGrayColor];
prompt.backgroundColor = [UIColor clearColor];
// Add the labels to the content view of the cell.
// Important: although UITableViewCell inherits from UIView, you should add subviews to its content view
// rather than directly to the cell so that they will be positioned appropriately as the cell transitions
// into and out of editing mode.
[self.contentView addSubview:type];
[self.contentView addSubview:name];
[self.contentView addSubview:prompt];
// self.autoresizesSubviews = YES;
}
return self;
}
相关文章推荐
- table 显示问题:- (id)initWithFrame:(CGRect)frame 中创建table 然后不显示
- - (void)performSegueWithIdentifier:(NSString *)identifier sender:(nullable id)sender 失效
- 加载xib文件,如果想在初始化的时候就添加点东西就重载-(id)initWithCoder:(NSCoder *)aDecoder
- IOS - (id)initWithStyle... 方法的使用
- 关于使用- (id)dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)index
- Could not load the "defaultimg" image referenced from a nib in the bundle with identifier "com.abc"
- Initalizing 'AppDelegate * __strong' with an expression of incompatible type ''id<UIApplicatioinDele
- Assertion failure in -[UITableView _dequeueReusableViewOfType:withIdentifier:], /BuildRoot/Library/C
- How to Add/Drop/Resize Redo Log with Physical Standby in place. [ID 473442.1]
- ValueError: Attempt to reuse RNNCell <tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl.BasicLSTMCell object at 0x7f1a3c448390> with a different variable scope than its first use.解决方法
- initWithRootViewController、init…
- SharePoint: In a CAML query, filter by lookup item ID, not by its value
- 转发:SP 2010: Find error messages with a Correlation ID token in SharePoint 2010
- BUG: in a frame because it set 'X-Frame-Options' to 'deny'
- iPhone开发 – iPhonAn App ID with Identifier 'XX.XX' is not available. Please enter a different string
- An App ID with Identifier 'com.jd.xxx' is not available. Please enter a different string.
- An App ID with Identifier "bundle id名字"is not available
- 【iOS开发】An Apple ID with identifier "xxx"is not available. Please enter a different string.
- registerNib:forCellReuseIdentifier: 加载自定义的UITableViewCell
- _mapView=[[BMKMapView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];报错