iOS tableView slide horizontal when use auto layout. but drag the tableView for a while. the tableView become normal. but cell.subViews use frame to layout will normal. the project is very old. all the code move to a new project, it's normal.
-
please add some code so can help u.. – ashmi123 Aug 10 '16 at 03:20
-
TableView is written programmatically or is in storyboard? – gurmandeep Aug 10 '16 at 03:29
3 Answers
The problem seems like be caused by the contentSize property's width is incorrect, like this one:
self.tableView.contentSize = CGSizeMake(self.tableView.bounds.size.width, self.tableView.contentSize.height);
If you change it to like this:
self.tableView.contentSize = CGSizeMake([UIScreen mainScreen].bounds.size.width + 20, [UIScreen mainScreen].bounds.size.height + 50);
Your problem seems cause by the wrong contentSize, but it fix when your refresh your tableView or add some new line to your tableView.
And the contentInset property also can cause this problem, please make sure that is made by (0,0,0,0), like this code:
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);

- 1,294
- 10
- 15
try [self.tableView setAlwaysBounceHorizontal:NO]
. If it wasn't contentSize issue you may need to check this property.

- 119
- 1
- 5
This is because constraints are not proper. They are not proportional to the device screen width, rather the constraints are applied as fixed constants which could be the reason that the tableview is sliding horizontally. Please make sure you add its trailing constraint.

- 1