Comments (14)
This is definitely a hack, but I currently solve this problem as follows:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
// Prevent the AMScrollingNavbar from creating a black gap the first time the feed is scrolled.
if (scrollView.contentOffset.y > 0
&& CGRectGetMinY(self.tableView.frame) != 0) {
CGRect frameAdjustedToPreventOffset = self.tableView.frame;
frameAdjustedToPreventOffset.size.height += frameAdjustedToPreventOffset.origin.y;
frameAdjustedToPreventOffset.origin.y = 0;
self.tableView.frame = frameAdjustedToPreventOffset;
}
}
from amscrollingnavbar.
Hi @dmur
The implementation is independent from the type of scrollview you want to attach it to, that's why there's no specific documentation for the tableview (in any case, the sample project shows the implementation for it).
you just need to call
[self followScrollView:self.tableView]
making sure that your navbar is not translucent.
The gap you are referring to might be an old issue that is now fixed in the latest version (that I'm waiting to push to cocoapods until I iron out a couple of issues), and you can get it by setting the :head
symbol in your podfile, like so:
pod 'AMScrollingNavbar, :head'
I hope this helps.
Cheers
from amscrollingnavbar.
Thanks for that. Unfortunately, updating to the head commit does not resolve the issue for me, I still need to use the workaround above to avoid the black gap. It's not a navigation bar translucency issue, mine is opaque.
FWIW, I wasn't sure if UITableViewController was supported because the example "AMTableViewController" is actually a UIViewController subclass. Perhaps that's the difference here.
from amscrollingnavbar.
Yep, you're right, it's probably the UITableViewController.
The AMTableViewController is a UIVIewController because I rarely use UITableViewControllers, since I like to have control over the view's hierarchy, and that's a good example of why I do that.
The current implementation of the scrollingnavbar requires that the scrollable view is contained in another view, and that's not the case with the UITableViewController.
I'll see if I can work around this and release an update.
Thanks for your feedback!
from amscrollingnavbar.
After some tinkering I can safely say that it can't be done. When you try to resize the tableview, the infamous black bar appears. It happens even if you resize the table manually.
That's why I never use a UITableViewController
, it's just too limited and always a pain. You should too stick with a plain UIViewController
and add a UITableView
yourself.
from amscrollingnavbar.
@andreamazz I tried switching to UIViewController, but when the navigation bar is contracted, I get an extra 44px space at the bottom of the table. I'm guessing this is because AMScrollingNavbar doesn't change the view's frame when it contracts the nav bar (i.e. intended behavior)? Or is this a bug? Thanks
from amscrollingnavbar.
Did you set the bottom constraint on your table to hug the bottom of its superview?
from amscrollingnavbar.
Yeah, I set the constraints as defined in the README (0 for all sides).
from amscrollingnavbar.
Hi @dmur
I made a quick video on how to implement the library in a UIViewController with a UITableView: https://vimeo.com/92721470
If you are still experiencing this issue, please let me know how does your setup differ from the one in the video.
from amscrollingnavbar.
Hey, cheers on the video -- loved the music :)
Unfortunately I couldn't tell if the example in the video has the same issue as I'm describing or not. The problem would be visible if, after integrating the scrolling navbar, when you scroll to the bottom of the table, there is a gap == 44px (because the frame of the table view no longer extends to the bottom of its superview).
Our setup is different in that we have a tab bar at the bottom. However I've a few minutes now, so I'll go ahead and replicate your example and then confirm whether or not that setup demonstrates the same issue.
from amscrollingnavbar.
Actually, looks like this is unrelated to this project, just has to do with using UITableView within a UIViewController that's embedded in a tab bar. To fix I just had to redo the constraints after adding the view controller relationship to the tab bar. Sorry for the trouble.
from amscrollingnavbar.
No trouble at all. I'm glad it's working.
Cheers
from amscrollingnavbar.
I'm also getting the black bar when using a UITableViewController (I have to use a UITableViewController) – I have read the comments above but can't understand how to resolve the issue, can you advise @dmur @andreamazz ? Thank you
from amscrollingnavbar.
@dawson See my ugly hack above to work around the black bar, in the second post. Just use that implementation for your scrollViewDidScroll in the UITableViewController (it's a UIScrollViewDelegate as well, since UITableViewDelegate inherits from UIScrollViewDelegate), and it should remove the black bar. However, also note that I have not used that code in production, and it could have some unintended bugs!
from amscrollingnavbar.
Related Issues (20)
- Live demo at https://appetize.io fails to get launched HOT 1
- Deprecated API Usage
- iOS 13 TabBar position is invalid after resuming device from lock HOT 1
- Table view buttons and title disappears after going back from full screen presented controller HOT 2
- Scroll to Top is not exact correct HOT 8
- Scroll when collapsed does not expand HOT 3
- Native SPM Support HOT 1
- Navigation bar isTranslucent = false is not working correctly HOT 2
- scroll to top doesn't work correctly HOT 11
- Can't not submit app to AppConnect since UIWebView is deprecated. HOT 2
- Container navigation controller breaks bar HOT 3
- Weird behaviour after accessing bottomLayoutGuide with iOS14 HOT 3
- Title goes beyond navigationbar on scrollEdge/compact appearance on IOS 13+
- Navigation bar background color changing HOT 6
- Navbar is not hiding in iOS 14 HOT 1
- iOS 15 Appearance issue HOT 1
- Fatal Exception: NSInternalInconsistencyException UICollectionView received layout attributes for a cell with an index path that does not exist: <NSIndexPath: 0xcf6b25b9e4f777ac> {length = 2, path = 0 - 2} HOT 1
- No more scrolling with iOS 15.1 HOT 10
- UITabbarController show space above navigationbar ios15
- Not Able to Scroll Up to the Top after Scrolling Down in iOS 15+ HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amscrollingnavbar.