所以,我试着四处寻找有关如何使用标题重新创建UILabel(理想情况下或UITextField)的信息(缺乏更好的工作)。
由于很难解释(我无法找到我想要的原因的一半),我附上了Facebook App的图像。
我如何创建这样的标签?单个还是多个?
很抱歉这个简单的问题,对于iPhone开发来说还是新手。
答案 0 :(得分:2)
如果您使用捕获中显示的UITableView
进行此操作,则可以使用UITableViewCell textLabel
属性显示标准的左对齐标签。然后,您只需将UITextField
添加到单元格中。
我在一个应用程序中完成了这个,它看起来很好而且非常简单。
更新: 这样的事情(未经测试,可能有一些拼写错误):
UITextField *textField = nil;
UITableViewCell *cell = [tableView dequeueCellWithReuseIdentifier: kIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault];
textField = [[UITextField alloc] init];
textField.tag = 12345;
[cell addSubview: textField];
textField.frame = CGRectMake(50, 5, 70, 25);
}
else
{
textField = [cell viewWithTag: 12345];
}
UPDATE2:UITextField未添加到UITableCellView。