didLoad 函数里面
i = @" ";
NSString *str = [NSString stringWithFormat:@"球队中至少 %@ 名队员通过",i];
_dataArray=[[NSMutableArray alloc] initWithObjects:@"队长、副队长、秘书均有权限审核",str, nil];
cell上面去赋值
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = [_dataArray objectAtIndex:indexPath.row];
cell.textLabel.font=SFONT_13;
UIImageView* weiXuanZhong=[[UIImageView alloc] initWithFrame:CGRectMake(290, 15, 15, 15)];
weiXuanZhong.userInteractionEnabled=YES;
weiXuanZhong.image=[UIImage imageNamed:@"联系人-未选"];
[cell.contentView addSubview:weiXuanZhong];
[weiXuanZhong release];
return cell;
}
//点击函数去创建textField
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (indexPath.row==1) {
view01=[[UIView alloc] initWithFrame:CGRectMake(50, ScreenHeight-350, ScreenWidth-100, 150)];
view01.backgroundColor=[UIColor lightGrayColor];
//请输入队员人数
UILabel *lab=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth-100, 40)];
lab.text=@"请输入队员人数";
lab.backgroundColor=clear;
lab.font=[UIFont boldSystemFontOfSize:15.0f];
lab.textAlignment=NSTextAlignmentCenter;
lab.userInteractionEnabled=YES;
[view01 addSubview:lab];
[lab release];
//创建输入框
receive=[[UITextField alloc] initWithFrame:CGRectMake(35, 45, 160, 40)];
receive.borderStyle=UITextBorderStyleRoundedRect;
receive.autoresizingMask = UIViewAutoresizingFlexibleWidth;
receive.textColor = [UIColor blackColor];
receive.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
receive.autocapitalizationType = UITextAutocapitalizationTypeNone;
receive.font=[UIFont systemFontOfSize:15];
receive.delegate=self;
[view01 addSubview:receive];
[receive release];
UIButton *btn=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[btn setTitle:@"确定" forState:UIControlStateNormal];
[btn setFrame:CGRectMake(60, 95, 100, 40)];
[btn addTarget:self action:@selector(returnClick) forControlEvents:UIControlEventTouchUpInside];
[view01 addSubview:btn];
[self.view bringSubviewToFront:view01];
[self.view addSubview:view01];
[view01 release] ;
}
}
//确定的时候需要去传值
//点击确定
-(void)returnClick
{
//在这里需要记得去把数据源 改变后 再去刷新 这样子 确定后数据才可以传过去的;
i=receive.text;
NSString *str = [NSString stringWithFormat:@"球队中至少 %@ 名队员通过",i];
_dataArray=[[NSMutableArray alloc] initWithObjects:@"队长、副队长、秘书均有权限审核",str, nil];
[_tableView reloadData];
[view01 removeFromSuperview];
}
//罗哥 教的 感动!!!!!!!!!!!