如何使UITableViewCell以全屏显示(允许分页)? [英] How to make UITableViewCell display fullscreen (allow paging)?

查看:268
本文介绍了如何使UITableViewCell以全屏显示(允许分页)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义的 UITableView-滚动,分页启用.因为每个单元格都有一个背景图像,所以我希望每次向上或向下滚动时都将其全屏显示.我尝试使我的 UITableViewCell为全屏(拉伸其高度与tableview一样大).

I have a custom UITableView - Scroll, Paging Enable. Because each of my cell has one background image, I want each time I scroll up or down it will display each image as full screen. I try to make my UITableViewCell to be full screen (stretch its height as big as the tableview).

但是,我遇到了一个问题:当我滚动(分页)时,单元格不会显示为全屏.它包含下一个单元格的一小部分.然后,每次向下滚动时,下一个单元格的部分就会越来越大.

However, I've got a problem: when I scroll(paging), the cell doesn't display as full screen. It contains a small part of the next cell. Then the part of next cell increase bigger and bigger each time I scroll(paging) down.

我没有看到UITableViewCell的任何自动布局选项,无法向原型单元添加约束.您能建议我这样做的方法吗?非常感谢.

I didn't see any Auto Layout Option for UITableViewCell, cannot add constraint to the prototype cell. Would you please suggest me the way to do it? Thank you very much.

推荐答案

我只需添加这两行代码,它对我有用

i just add this two lines of code and it works for me

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return tableView.frame.size.height;
}

这篇关于如何使UITableViewCell以全屏显示(允许分页)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆