Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting ScrollViewInsets makes scrollbar start from top

I have the following code to set my scrollView's inset:

// top margin for table
self.automaticallyAdjustsScrollViewInsets = NO;
CGFloat navbarHeight = self.navigationController.navigationBar.frame.size.height;
CGFloat statusHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
CGFloat tabBarHeight = self.tabBarController.tabBar.frame.size.height;
CGFloat filterBtnsContainerHeight = 36.0;
CGFloat insetTopMargin = navbarHeight + statusHeight + filterBtnsContainerHeight;
[self.postsTable setContentInset:UIEdgeInsetsMake(insetTopMargin,0,tabBarHeight,0)];

It works great, except that the scrollbar now starts from top and ends at bottom. It should start after the navigaton bar and end before the tabbar. Is there a way to set the container for the scrollbar?

like image 805
Maximus S Avatar asked Apr 25 '26 05:04

Maximus S


1 Answers

After setting your scrollViewInset try tableView.scrollIndicatorInset = tableView.scrollViewInset

like image 199
Fennelouski Avatar answered Apr 27 '26 19:04

Fennelouski