【发布时间】:2010-11-01 18:57:54
【问题描述】:
我有一个 UITableViewCell,它有一个 textLabel 和一个 UITextField 作为子视图附加,如下所示:
cell = [tableView dequeueReusableCellWithIdentifier:Value1CellIdentifier];
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:Value1CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.text = @"Name";
UITextField *playerTextField = [[UITextField alloc] initWithFrame:CGRectMake(110, 10, 185, 30)];
playerTextField.adjustsFontSizeToFitWidth = YES;
playerTextField.textColor = [UIColor blackColor];
playerTextField.placeholder = @"John Doe";
playerTextField.textAlignment = UITextAlignmentLeft;
[playerTextField setEnabled: YES];
[cell addSubview:playerTextField];
[playerTextField release];
textLabel 占用了很多空间。如何设置 textLabel 的宽度,让 UITableViewCell 的其余部分获得提醒宽度?
谢谢
【问题讨论】:
标签: iphone iphone-sdk-3.0 ios ios4