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
If you've applied tableView.contentInsetAdjustmentBehavior =
, try selecting the value .scrollableAxes
instead of .automatic
or .always
You can set AlwaysBounceHorizontal
property of UITableView to false as follows:
Swift:
self.tableView.alwaysBounceHorizontal = false
Objective-C:
[self.tableView setAlwaysBounceHorizontal:NO];
self.tblViewProfile.alwaysBounceHorizontal = false // using coding
Or by storyboard/xib
Un tick horizontal bounce option in storyboard or xib
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);
If you created the table view in the interface builder then there is an option check the scroll vertically and uncheck the horizontal scroll.
If you didn't then you should try create it in the interface builder and assign it to your IBOutlet
Hope it helps !
Check if the content inset property of the table view is nonzero. If so reset it to zero.