【问题标题】:How to make UITableview exact height?如何使 UITableview 精确高度?
【发布时间】:2014-02-06 06:17:52
【问题描述】:

我有以下问题 如果我单击此按钮,则我在主视图上有一个按钮,将主视图上的子视图添加为表格视图 这是代码

FNsettingsViewController *fnsettings = [[FNsettingsViewController alloc]initWithNibName:@"FNsettingsViewController" bundle:nil];
fnsettings.delegate=self;
[fnsettings.view setFrame:CGRectMake(0, 30, self.view.frame.size.width,250)];
[self.view addSubview:fnsettings.view];

在我点击按钮后,将子视图作为 tableview,但其余部分有一个空格。

那么如何去除剩余的空白。

请任何认识的人帮助我。

【问题讨论】:

  • 设置fnsettings.backgroundColor = [UIColor clearColor];

标签: ios iphone objective-c uitableview


【解决方案1】:

在为 Tableview 分配值之前,您会知道单元格计数对吗?试试我的代码:

float height=[arrayTableValues count]*height of your single cell;
tableview.frame=CGRectMake(0,30,self.view.frame.size.width,height);

【讨论】:

    【解决方案2】:

    你好,你可以试试这些

    //You can manage the height of a table view using this method.
    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath     *)indexPath
    {
    
    // Return the height of the row what ever you want Like:below.
    return 50;
    }
    

    谢谢

    【讨论】:

      猜你喜欢
      • 2017-02-16
      • 2010-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-05
      • 2014-03-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多