数据源dataArray与tableView需要同步操作



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];

}







//罗哥 教的     感动!!!!!!!!!!!



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值