- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:SimpleTableIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:SimpleTableIdentifier] autorelease];
UILabel *playerHeading=[[UILabel alloc ]initWithFrame:CGRectMake(5.0f, 10.0f, 70.0f, 30.0f)];
[playerHeading setBackgroundColor:[UIColor clearColor]];
NSString *str=[NSString stringWithFormat:@"Player %i",indexPath.row];
[playerHeading setText:str];
[playerHeading setFont:[UIFont boldSystemFontOfSize:15]];
if(indexPath.section%2==0){
playerHeading.textColor=[UIColor redColor];
}
else {
playerHeading.textColor=[UIColor blueColor];
}
UITextField *txt=[[UITextField alloc]initWithFrame:CGRectMake(80.0f, 13.0f, 170.0f, 30.0f)];
[txt setBackgroundColor:[UIColor clearColor]];
//[txt setBackgroundColor:[UIColor whiteColor]];
[txt setTextColor:[UIColor grayColor]];
txt.delegate=self;
//[txt setBorderStyle:UIBorderStyle ]
[txt setText:@"Enter Player name"];
//txt.layer.cornerRadius=8.0f;
// txt.layer.masksToBounds=YES;
//txt.layer.borderColor=[[UIColor redColor]CGColor];
// txt.layer.borderWidth= 1.0f;
[cell.contentView addSubview:txt];
[cell.contentView addSubview:playerHeading];
[cell.contentView setAlpha:0.8f];
//ce]ll.textLabel.text = [listData objectAtIndex:row];
}
return cell;
}
我希望按顺序显示的数字,如球员0,玩家1,玩家2 ... 但我滚动表我以随机格式获得数字,如播放器1,播放器0,播放器3 请帮助如何解决此问题。
但我有动态使用的TextField,如果我尝试添加他们如何可以获取它们的值是一个数组,数组将有8个TextField的最大值:虽然我使用了100 – androider
你会做同样的你的文本框但会将字符串值(而不是字段)保留在数组中,并每次更新。编辑文本字段时,获取正在编辑的行的索引路径,以便知道要更新的数组的哪个元素。使用 – jrturton