所以我试图找出我的注册页面的想法在Xcode - 是这样的:http://weswilliams.me/wp-content/uploads/2011/06/IMG_2525-e1307910945329.png文本字段 - iPhone
无论如何,我想不出什么反对他们正在使用来实现此显示。它看起来像一个Button上的TextField?如果是这样,我永远不会让文本框位于顶部,它总是落在按钮后面,从而使其不可见。
任何提示或建议?
所以我试图找出我的注册页面的想法在Xcode - 是这样的:http://weswilliams.me/wp-content/uploads/2011/06/IMG_2525-e1307910945329.png文本字段 - iPhone
无论如何,我想不出什么反对他们正在使用来实现此显示。它看起来像一个Button上的TextField?如果是这样,我永远不会让文本框位于顶部,它总是落在按钮后面,从而使其不可见。
任何提示或建议?
这不是按钮上的文本框。实际上它是表格视图内的文本框。您必须执行以下操作:
尝试在此之前这个
设置行的表视图都有数。
- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [table dequeueReusableCellWithIdentifier:@"Cell"];
if(cell == nil)
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"] autorelease];
cell.textLabel.text = [[NSArray arrayWithObjects:@"First",@"Second",@"Third",@"Forth",@"Fifth",@"Sixth",@"Seventh",@"Eighth",@"Nineth",@"Tenth",nil]
objectAtIndex:indexPath.row];
if (indexPath.row % 2) {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 200, 21)];
textField.placeholder = @"Enter Text";
textField.text = [inputTexts objectAtIndex:indexPath.row/2];
textField.tag = indexPath.row/2;
textField.delegate = self;
cell.accessoryView = textField;
[textField release];
} else
cell.accessoryView = nil;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
或者,你可以看到这个链接See this answer on SO
这是一个基本的分组UITableView。阅读Apple文档。这方面也有很多教程。
这应该是一个评论 – NAZIK