禁用 UITableView 水平滚动
- 作者: 爱情像杯酒
- 来源: 51数据库
- 2022-10-25
问题描述
我创建了一个带有小框架的 UITableView,例如 (0,0,50,50).我想禁用水平滚动但保持垂直滚动.
I created a UITableView with a small frame, like (0,0,50,50). I want to disable the horizontal scrolling but keep the vertical scrolling.
我设置了self.table.bounces = NO,但是tableview也不能垂直滚动.结果动画就不是那么完美了.
I set self.table.bounces = NO, but the tableview can't be vertically scrolled, either. As a result, the animation is not so perfect.
那么有人有提示吗?
谢谢!
推荐答案
改变tableView的内容大小,确保内容大小的宽度不大于框架大小
change the content size of the tableView, make sure the width of the content size is not greater than the frame size
self.tableView.contentSize = CGSizeMake(self.tableView.frame.size.width, self.tableView.contentSize.height);
推荐阅读
热点文章
检查拆分键盘
0
带有“上一个"的工具栏和“下一个"用于键盘输入AccessoryView
0
Activity 启动时显示软键盘
0
UIWebView 键盘 - 摆脱“上一个/下一个/完成"酒吧
0
在 iOS7 中边缘滑动时,使键盘与 UIView 同步动画
0
我的 iOS 应用程序中的键盘在 iPhone 6 上太高了.如何在 XCode 中调整键盘的分辨率?
0
android:inputType="textEmailAddress";- '@' 键和 '.com' 键?
0
禁用 iPhone 中键盘的方向
0
Android 2.3 模拟器上的印地语键盘问题
0
keyDown 没有被调用
0
