我们可以在UITableViewCell内部添加滚动视图吗? [英] Can we add a scroll view inside UITableViewCell?

查看:101
本文介绍了我们可以在UITableViewCell内部添加滚动视图吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有必要在其中显示一些图像,这些图像根据它们所属的组而有所不同.我使用表格视图来查看在组下列出的图像.用户必须水平滚动才能查看特定组中的更多图像. 我们可以将滚动视图添加到tableview行以允许用户水平滚动图像列表吗? 我搜索了一下,有些评论说它在苹果的HIG中是不允许的,有些评论说 只要您设置了UIScrollView的contentSize属性正确,则UIScrollView将在水平轴上正确滚动

I have requirement where I have to show some images which are differentiated according to Groups they belong to. I have used a table view to view images listed under groups. User has to scroll horizontally to view more images in a particular group. Can we add a scroll view to tableview row to allow user to scroll list of images horizontally? I searched a bit, some comments say its not allowed in apple's HIG some comments say You can add a UIScrollView to a UITableViewCell and as long as you set the contentSize property of the UIScrollView correctly then the UIScrollView will scroll correctly in the horizontal axis

我可以就此得到任何确认吗? 或任何其他方法都可以在不使用tableview的情况下实现对不同数据的水平和垂直滚动

May I get any confirmation on this ?? Or any alternative approach to achieve horizontal and vertical scrolling for different data without using tableview

推荐答案

您当然可以在tableView中添加scrollView.

Of course you can add scrollView in tableView.

 UIScrollView *scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 100)];            
 [cell.contentView addSubview:scrollView];

现在您可以相应地设置滚动视图的属性.

Now you can set properties for scroll view accordingly.

这篇关于我们可以在UITableViewCell内部添加滚动视图吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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