本文介紹了禁用 UITableView 水平滾動的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
我創(chuàng)建了一個帶有小框架的 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.
我設(shè)置了self.table.bounces = NO
,但是tableview也不能垂直滾動.結(jié)果動畫就不是那么完美了.
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的內(nèi)容大小,確保內(nèi)容大小的寬度不大于框架大小
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);
這篇關(guān)于禁用 UITableView 水平滾動的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!