Mantas Laurinavičius
Mantas Laurinavičius

Reputation: 951

Scroll outside of UITableView frame

How to scroll whole UITableView content outside of UITableView frame? Setting table.scrollIndicatorInsets does not let to scroll upwards and content disappear behind another view at the top.

Upvotes: 1

Views: 2721

Answers (3)

Archit rai saxena
Archit rai saxena

Reputation: 107

select Table view-> got to Attribute indicator -> tick on "Clip To Bounds". Done

Upvotes: 2

PaulDaPigeon
PaulDaPigeon

Reputation: 303

As @Tushar pointed out setting the size of view might be the correct approach here, but double the size of the contentview, might be a bit overkill if you have a really long tableview. I would suggest adding the size of the current window instead.

CGFloat oldContentHeight = tableView.contentSize.height;
CGFloat windowHeight = [[[UIApplication sharedApplication] delegate] window].frame.size.height);
tableView.contentSize = CGSizeMake(tableView.contentSize.width, oldContentHeight + windowHeight);

Upvotes: 1

Tushar
Tushar

Reputation: 3052

Try this :

after loading of the view completed e.g after viewDidAppear:

CGFloat oldContentHeight = tableView.contentSize.height;
tableView.contentSize = CGSizeMake(tableView.contentSize.width, oldContentHeight + tableView.bounds.size.height);

Updated the answer.

Upvotes: 2

Related Questions