Disable UITableView horizontal scroll

前端 未结 6 1584
梦毁少年i
梦毁少年i 2021-01-13 13:02

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.

I set se

6条回答
  •  感动是毒
    2021-01-13 13:32

    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);
    

提交回复
热议问题