gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:32:52 25 4
gpt4 key购买 nike

我在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com