iphone - 为什么我的 UItableView 不水平滚动,而我将 ContentSize 设置得更大?

标签 iphone ios uitableview uiscrollview uikit

我在 ScrollView (名为parentScrollView)中放置了一些字段+ UITableVIew(名为myTableView)。现在我的 TableView 包含多列,因此由于它是 ScrollView 内的 ScrollView ,我在 ViewDidLoad 中尝试了此操作:

[[self parentScrollView] setContentSize:CGSizeMake(320, 1000)];
self.myTableView.contentSize=CGSizeMake(640,300);

只有parentScrollView垂直滚动而不是myTableView水平滚动,为什么?

最佳答案

这是设计使然

A table view in the UIKit framework is limited to a single column because it is designed for a device with a small screen. UITableView is a subclass of UIScrollView, which allows users to scroll through the table, although UITableView allows vertical scrolling only.

https://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UITableView_Class/Reference/Reference.html

关于iphone - 为什么我的 UItableView 不水平滚动,而我将 ContentSize 设置得更大?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9654416/

相关文章:

ios - 动态创建的按钮和 Storyboardsegue

iOS Swift - 加载自定义表格单元格

ios - 如何在 iOS 的 tableview 中只选择两行?

iphone - 在 iPhone 的 UIImageView 中显示图像

iphone - 计时器:如何在后台保持计时器处于事件状态

iphone - 使用mapkit计算半径(以米为单位)

iphone - 更改 MKMapView 中的 MKMapType 并保留自定义 pinImage 用于注释

ios - 无法使用 KingFisher Swift 将类型 '(_) -> ()' 的值转换为预期的参数类型 'CompletionHandler?'

iphone - 如何从 uitableview 中的选定行填充标签字段

javascript - 如何让我的响应式网站在手机上使用 "Request a desktop site"?