Ios 如何在iphone中删除tableView单元格下方的行

Ios 如何在iphone中删除tableView单元格下方的行,ios,iphone,Ios,Iphone,我有一个iphone应用程序,在其中我添加了tableView,在tableView单元格中我添加了textfield,但问题是它在tableView中的textfield下面显示了一行,如图所示,这里附加的是我的代码 我想删除输入字段Enter标记下面的行 -(UITableViewCell *)tableView:(UITableView *)atableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableView

我有一个iphone应用程序,在其中我添加了tableView,在tableView单元格中我添加了textfield,但问题是它在tableView中的textfield下面显示了一行,如图所示,这里附加的是我的代码

我想删除输入字段Enter标记下面的行

-(UITableViewCell *)tableView:(UITableView *)atableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
  if(!cell) {
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
   // cell.backgroundView = [[UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"tabelsales.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0] ];
    //cell.backgroundColor = [UIColor clearColor];
   }

   for (UIView *subView in cell.subviews)
   {
    if (subView.tag == 2 || subView.tag == 22) 
    {
        [subView removeFromSuperview];
    }
   }



  tableView.backgroundView=nil;


   if(indexPath.section==0){
    tagInputField =[[UITextField alloc]initWithFrame:CGRectMake(0,1,249,28)];



    tagInputField.contentVerticalAlignment=UIControlContentVerticalAlignmentCenter;
    tagInputField.textAlignment=UITextAlignmentLeft;

    tagInputField.backgroundColor=[UIColor whiteColor];

    tagInputField.tag = 2;
    tagInputField.delegate = self;
    tagInputField.clearButtonMode = UITextFieldViewModeWhileEditing;


    tagInputField.font=[UIFont fontWithName:@"Myriad-Pro" size:8];
    [tagInputField setText:@"Enter tag here "];
    tagInputField.textColor =[UIColor grayColor];
    [cell addSubview:tagInputField];
    if(tagArray.count >0)
    {

        [tagInputField setBorderStyle:UITextBorderStyleNone];





    }
    else {
          [tagInputField setBorderStyle:UITextBorderStyleRoundedRect];





    }


    return cell;
    }

   if(indexPath.section==1) {
    UIButton *crossButton =[[UIButton alloc]initWithFrame:CGRectMake(228, 8, 18, 18)];
    crossButton.tag = 22; //use a tag value that is not used for any other subview
    //crossButton.backgroundColor = [UIColor purpleColor];
    crossButton.backgroundColor  = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Cross.png"]];
    [cell addSubview:crossButton];
    cell.textLabel.font =[UIFont fontWithName:@"Myriad-Pro" size:8];
    cell.textLabel.textColor =[UIColor grayColor];

    cell.backgroundColor=[UIColor whiteColor];

    cell.textLabel.text =[tagArray objectAtIndex:indexPath.row];
    [crossButton addTarget:self action:@selector(deleteCell:) forControlEvents:UIControlEventTouchUpInside];

    [tagInputField setFrame:CGRectMake(8,1,240,30)];

    tableView.backgroundColor=[UIColor whiteColor];







    [publishButton setFrame:CGRectMake(40,560,250, 50)];

    [descriptionTextImageView setFrame:CGRectMake(48,450,250,90)];






    return cell;
    }

应将UITableView的separatorStyle属性设置为UITableViewCellSeparatorStyleNone。

应将UITableView的separatorStyle属性设置为UITableViewCellSeparatorStyleNone。

应将UITableView的separatorStyle属性设置为UITableViewCellSeparatorStyleNone。

应将UITableView的separatorStyle属性设置为UITableView到UITableViewCellSeparatorStyleNone。

它可以来自xib。将separator设置为None,如下屏幕截图所示。希望这会有帮助。谢谢

它可以来自xib。将separator设置为None,如下屏幕截图所示。希望这会有帮助。谢谢

它可以来自xib。将separator设置为None,如下屏幕截图所示。希望这会有帮助。谢谢

它可以来自xib。将separator设置为None,如下屏幕截图所示。希望这会有帮助。谢谢

更新:

1) 将tableview分隔符样式的属性设置为UITableViewCellSeparatorStyleNone

2) 设置分离器颜色的属性,如:

   [self.tableView setSeparatorColor:[UIColor clearColor]];
3) 另一种简单的移除seprator的方法是将自定义seprator添加到1px高度的简单UIView中:

  UIView* separatorLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 1)];
  separatorLineView.backgroundColor = [UIColor clearColor]; // as per your requirement set color.
  [cell.contentView addSubview:separatorLineView];
4) 编写tableview的此委托方法:

 - (float)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 
   { 
       return 0.01f;// here remove your footer
   }

  - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
     {
       // To "clear" the footer view
       return [[UIView new] autorelease];
     }
5) 试试这个:

   self.tblView=[[UITableView alloc] initWithFrame:CGRectMake(0,0,320,460) style:UITableViewStylePlain];
   self.tblView.delegate=self;
   self.tblView.dataSource=self;
   [self.view addSubview:self.tblView];

   UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 10)];
   v.backgroundColor = [UIColor clearColor];
   [self.tblView setTableHeaderView:v];
   [self.tblView setTableFooterView:v];
   [v release];

更新:

1) 将tableview分隔符样式的属性设置为UITableViewCellSeparatorStyleNone

2) 设置分离器颜色的属性,如:

   [self.tableView setSeparatorColor:[UIColor clearColor]];
3) 另一种简单的移除seprator的方法是将自定义seprator添加到1px高度的简单UIView中:

  UIView* separatorLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 1)];
  separatorLineView.backgroundColor = [UIColor clearColor]; // as per your requirement set color.
  [cell.contentView addSubview:separatorLineView];
4) 编写tableview的此委托方法:

 - (float)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 
   { 
       return 0.01f;// here remove your footer
   }

  - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
     {
       // To "clear" the footer view
       return [[UIView new] autorelease];
     }
5) 试试这个:

   self.tblView=[[UITableView alloc] initWithFrame:CGRectMake(0,0,320,460) style:UITableViewStylePlain];
   self.tblView.delegate=self;
   self.tblView.dataSource=self;
   [self.view addSubview:self.tblView];

   UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 10)];
   v.backgroundColor = [UIColor clearColor];
   [self.tblView setTableHeaderView:v];
   [self.tblView setTableFooterView:v];
   [v release];

更新:

1) 将tableview分隔符样式的属性设置为UITableViewCellSeparatorStyleNone

2) 设置分离器颜色的属性,如:

   [self.tableView setSeparatorColor:[UIColor clearColor]];
3) 另一种简单的移除seprator的方法是将自定义seprator添加到1px高度的简单UIView中:

  UIView* separatorLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 1)];
  separatorLineView.backgroundColor = [UIColor clearColor]; // as per your requirement set color.
  [cell.contentView addSubview:separatorLineView];
4) 编写tableview的此委托方法:

 - (float)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 
   { 
       return 0.01f;// here remove your footer
   }

  - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
     {
       // To "clear" the footer view
       return [[UIView new] autorelease];
     }
5) 试试这个:

   self.tblView=[[UITableView alloc] initWithFrame:CGRectMake(0,0,320,460) style:UITableViewStylePlain];
   self.tblView.delegate=self;
   self.tblView.dataSource=self;
   [self.view addSubview:self.tblView];

   UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 10)];
   v.backgroundColor = [UIColor clearColor];
   [self.tblView setTableHeaderView:v];
   [self.tblView setTableFooterView:v];
   [v release];

更新:

1) 将tableview分隔符样式的属性设置为UITableViewCellSeparatorStyleNone

2) 设置分离器颜色的属性,如:

   [self.tableView setSeparatorColor:[UIColor clearColor]];
3) 另一种简单的移除seprator的方法是将自定义seprator添加到1px高度的简单UIView中:

  UIView* separatorLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 1)];
  separatorLineView.backgroundColor = [UIColor clearColor]; // as per your requirement set color.
  [cell.contentView addSubview:separatorLineView];
4) 编写tableview的此委托方法:

 - (float)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 
   { 
       return 0.01f;// here remove your footer
   }

  - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
     {
       // To "clear" the footer view
       return [[UIView new] autorelease];
     }
5) 试试这个:

   self.tblView=[[UITableView alloc] initWithFrame:CGRectMake(0,0,320,460) style:UITableViewStylePlain];
   self.tblView.delegate=self;
   self.tblView.dataSource=self;
   [self.view addSubview:self.tblView];

   UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 10)];
   v.backgroundColor = [UIColor clearColor];
   [self.tblView setTableHeaderView:v];
   [self.tblView setTableFooterView:v];
   [v release];

为table View将分隔符样式设置为none检查tableView上的分隔符,并请创建UITableViewCell的子类,因为我不想这么说,但这不是好代码。删除然后添加文本文件的想法会让我今晚睡不着觉=p.将表格视图的分隔符样式设置为“无”检查表格视图上的分隔符,请创建UITableViewCell的子类,因为我不想这么说,但这不是好代码。删除然后添加文本文件的想法会让我今晚睡不着觉=p.将表格视图的分隔符样式设置为“无”检查表格视图上的分隔符,请创建UITableViewCell的子类,因为我不想这么说,但这不是好代码。删除然后添加文本文件的想法会让我今晚睡不着觉=p.将表格视图的分隔符样式设置为“无”检查表格视图上的分隔符,请创建UITableViewCell的子类,因为我不想这么说,但这不是好代码。你删除然后添加文本文件的想法会阻止我今晚睡觉。