Open xhzengAIB opened 10 years ago
Hi! @xhzengAIB
I've faced with the same problem, here is my solution
1) create search bar & place it behind the navigation bar.
2) Then, on scroll view did scroll do the following thing: //moove bar correspondint to table scroll position CGFloat newY = -self.treeView.contentOffset.y - self.searchBar.height; [self.searchBar setY:newY]; CGFloat barier = 57.0;
if (self.searchBar.y > barier) {//table content scrolled down enough to change offset and show the bar
if (!segmentShown) {
CGRect statusBarViewRect = [[UIApplication sharedApplication] statusBarFrame];
float heightPadding = statusBarViewRect.size.height + self.navigationController.navigationBar.frame.size.height + self.searchBar.height;
self.treeView.contentInset = UIEdgeInsetsMake(heightPadding, 0.0, 0.0, 0.0);
self.treeView.contentOffset = CGPointMake(0.0, -heightPadding);
segmentShown = YES;
}
}
if (self.searchBar.y < 27) {//table content is scrolling up enough to change offset and hide the bar
if (segmentShown) {
CGRect statusBarViewRect = [[UIApplication sharedApplication] statusBarFrame];
float heightPadding = statusBarViewRect.size.height + self.navigationController.navigationBar.frame.size.height;
self.treeView.contentInset = UIEdgeInsetsMake(heightPadding, 0.0, 0.0, 0.0);
self.treeView.contentOffset = CGPointMake(0.0, -heightPadding);
segmentShown = NO;
}
}
hi! @Augustyniak Thank you very much for your open source library, but now I have a small problem: how can I top in the treeView embedded a UISearchBar? Jack