Tag: 行高

一些dynamic高度的tableview单元格,其他高度固定的单元格

我有一个tableview。 我想要一些具有dynamic高度的tableview单元格,而其他单元格的高度是固定的。 对于dynamic高度,我在viewDidLoad视图控制器委托中使用了以下几行代码。 tableView.estimatedRowHeight = 200 tableView.rowHeight = UITableViewAutomaticDimension 在一个tableview中有固定加权单元格和自定义单元格的有效方法是什么? 提前致谢。

在iPhone中dynamic更改UITableviewCell高度?

我在UITableViewCell中有三个自定义的UILabel。 像这样的单元devise, Date(12.1.2012) Time(12.00pm) Cost: $20.00 Details 我已经在- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;指定了行高100 – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; 。 但是,现在细节有时会从服务器返回空(Null)。 在那个时候,我需要从单元格中删除细节标签,并将特定的单元格(行)高度更改为70.我该怎么做? 我在Google中最好地search了我的级别。 但是,我仍然只是困惑这样做。 你能帮我么? 谢谢。 我从这个链接了一些想法 – http://www.cimgf.com/2009/09/23/uitableviewcell-dynamic-height/ 。 他们只用一个标签来调整行高。 请帮帮我。 – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 90; } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView […]

UITableViewCell +dynamic高度+自动布局

我来自这个伟大的答案: 在UITableView中使用自动布局来实现dynamic单元格布局和可变行高 我已经实现了这个答案中描述的东西,但是我面对一个不同的场景。 我没有一个UILabel但我有一个dynamic的UILabel列表。 我创build了一个图像,显示了表视图应该看起来的一些不同情况: 在repo的当前状态下,单元格不会垂直增长以适合单元格的contentView 。 UPDATE REPO: https : //github.com/socksz/DynamicHeightCellAutoLayout 如果您试图从回购项目中获得项目并运行它,您可以确切地看到我所指的是什么问题。 我不能得到让它工作的缺失。

UITableView单元格的dynamic高度问题(Swift)

可变长度的dynamic文本被注入tableview单元格标签。 为了使tableview单元的高度dynamicresize,我已经在viewDidLoad()实现了: self.tableView.estimatedRowHeight = 88.0 self.tableView.rowHeight = UITableViewAutomaticDimension 这适用于尚未滚动的单元格(因为在滚动到单元格时调用UITableViewAutomaticDimention ),但不适用于在加载数据表格时初始呈现在屏幕上的单元格。 我试图简单地重新加载数据(如许多其他资源中所build议的): self.tableView.reloadData() 在viewDidAppear()和viewWillAppear()都是无济于事。 我迷路了..有谁知道如何让Xcode呈现最初加载在屏幕上的单元格的dynamic高度? 请让我知道,如果有更好的替代方法。

dynamic增加UILabel&TableView Cell的高度?

我有一个UITableView中显示一个自定义单元格。我的单元格有两个标签和一个视图如下图所示。 我已经给这个左视图的约束了 项目标签约束 中心视图约束 正确的视图constarints 我正在使用一个bean类来存储两个标签的数据,并将该bean对象添加到一个数组中。我在heightForRowAtIndexPath中使用下面的代码。 – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { // Calculate a height based on a cell if(!self.customCell) { self.customCell = [self.tableView dequeueReusableCellWithIdentifier:@"thirdcell"]; } // Configure the cell Instrument *inst=[arr_instSpecs objectAtIndex:indexPath.row]; self.customCell.label_item.text=inst.item; self.customCell.label_desc.text=inst.desc; // Layout the cell [self.customCell layoutIfNeeded]; // Get the height for the cell CGFloat height = [self.customCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height; // […]

为什么UITableViewAutomaticDimension不工作?

您好,有很多问题回答了UITableViewCell的UITableView的dynamic高度。 不过,当我做到这一点时,我感到奇怪。 这里有一些答案: 在这里和这里 通常这会回答细胞的dynamic高度 tableView.estimatedRowHeight = 44.0 tableView.rowHeight = UITableViewAutomaticDimension 但在我的情况下,我想知道这行不会做任何事情。 在单击splitview内的tabbar后,我的UITableView正在被查看。 这有帮助吗? 也许我错过了一些东西。 任何人都可以帮助我,我花了2个小时做傻事。 这些是我对标题的限制标题可能很长,但标签不是。 这是我的手机

带dynamic高度iOS的UITableViewCell

我在我的应用程序中使用CustomCell实现了TableView, 我想根据UITableViewCell中的文本长度,我的UITableViewCelldynamic高度, 这里是Customcell的快照 :这里是我的UITableView的快照 : heightForRowAtIndexPath代码片段 #define FONT_SIZE 14.0f #define CELL_CONTENT_WIDTH 320.0f #define CELL_CONTENT_MARGIN 10.0f – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; { NSString *text = [DescArr objectAtIndex:[indexPath row]]; CGSize constraint = CGSizeMake(CELL_CONTENT_WIDTH – (CELL_CONTENT_MARGIN * 2), 20000.0f); CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap]; CGFloat height = MAX(size.height, 100.0); return height; } 正如您在第二张图片中看到的,单元格的高度是固定的,它不会随文本(内容)大小而改变。 我在哪里犯错? 我怎样才能使标签或单元格根据其内容/文本更新其大小?