【问题标题】:How to dynamic cell height with Parse?如何使用 Parse 动态化单元格高度?
【发布时间】:2016-05-26 23:38:24
【问题描述】:

这是我的故事板:

我用来获取图像的方法是:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {

     cell.mainImage.file = (PFFile *)object[@"image"];
    [cell.mainImage loadInBackground];
}

行高设置为:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
       return 501.0f;
}

我也想完美地填充图像,就像 instagram 一样。我不希望图像的顶部和底部都有条。

【问题讨论】:

标签: ios objective-c uitableview dynamic


【解决方案1】:

这对我有用

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
 return UITableViewAutomaticDimension;
}

【讨论】:

  • 你的故事板中有 UIImageView 还是在 cellForRow 中创建的?
  • 我在故事板的单元格中有图像,具有自动布局
  • 在情节提要中使用图像,您如何设置自动布局以便图像可以调整大小?我不想有边界
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-11-14
  • 2014-06-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-12-11
相关资源
最近更新 更多