luugiathuy / gtscrollnavigationbar Goto Github PK
View Code? Open in Web Editor NEWA scrollable UINavigationBar that follows a UIScrollView
License: BSD 3-Clause "New" or "Revised" License
A scrollable UINavigationBar that follows a UIScrollView
License: BSD 3-Clause "New" or "Revised" License
Thank you for this project!
Would be nice to allow a sub toolbar similar to Facebook "Status Update" that scrolls first, then once fully collapsed the navigation bar collapses.
I can attach a screenshot of Facebook's implementation, but I'm assuming you have it installed since it was part of your inspiration.
Edit:
Another possibility is a toolbar at the bottom that scrolls out of view. Digg and IGN but have these bottom toolbars.
This issue arise when pushing a new UIViewController
when the navigationBar is in hidden mode. Can't find out why, that's weird.
Congratulations for the project!
Simple and easy to use.
You could add your project to Cocoapods?
You need to create a .podspec
file like this tutorial.
Hi,
When the ContentSize
of a UIScrollView
is smaller than the size of the frame the animation looks so weird because the UINavigationBar
starts the animation when it should not be animated.
To test that scenario just add 4 columns in the tableView.
That can be easily fixed with this code:
- (void)handlePan:(UIPanGestureRecognizer*)gesture
{
...
if ( self.scrollView.frame.size.height + (self.bounds.size.height * 2) >= self.scrollView.contentSize.height) {
return;
}
...
}
Not sure what part of it is incompatible with iOS 8 / Swift, but may just be an issue with the early beta...
I'm working on this small app with master detail and it uses a storyboard. Is there anyway to use this with storyboards? I don't know where to put your init code and everything I tried fails.
Great library -- works very well, generally.
When using a UITabBarController containing more than 5 viewControllers, the "More" button appears on the right. The navigationController/tableViewController/navigationBar for this item is created automatically by the SDK, and does not adhere to anything defined by GTScrollNavigationBar. Hence, you can't scroll the "More" tableView's navigationBar the way the library currently works, and the child controllers pushed from there cannot implement this functionality.
Any way around that that you're aware of?
Last comment, I promise, everything else is perfect.
I have a UITableView with a UISearchBar, and a UIRefreshControl. My goal is to add this GTScrollNavigationBar (with the addition of a sub menu Issue #1 ). When the search bar is visible by default, there are no issues. But when the search bar is set to be hidden by default it screws things up.
Start by modifying the example by:
@interface DemoTableViewController : UITableViewController <UISearchBarDelegate, UISearchDisplayDelegate> {
UISearchBar *searchBar;
UISearchDisplayController *searchDisplayController;
}
2.Modify DemoTableViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
self.refreshControl = refreshControl;
//Uncomment this line, to reproduce the issue
//[self.tableView setContentOffset:CGPointMake(0,44) animated:YES];
searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
searchBar.placeholder = @"Filter Types";
searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
searchDisplayController.delegate = self;
searchDisplayController.searchResultsDataSource = self;
searchDisplayController.searchResultsDelegate = self;
self.tableView.tableHeaderView = searchBar;
}
- (void)refresh:(UIRefreshControl *)refreshControl {
[refreshControl endRefreshing];
}
Run this, and everything performs as expected. Then uncomment [self.tableView setContentOffset:CGPointMake(0,44) animated:YES];
. Now, tap and hold near the bottom of the screen and drag up. Instead of the the menu scrolling out of view, it will almost disappear, and then snap back to normal height. It will continue this snapping until you remove your finger from the screen.
Any help on implementing this would be great. I this its got to be in handlePan
or setFrame
. Ill keep playing around with it, to see if i can get it on my own.
Boy double tap on status bar to scroll to top the app fault.
This is easily reproducible in the example app:
I think scrollingnavigationbar should be nullable for use with Swift.
@interface UINavigationController (GTScrollNavigationBarAdditions)
@property(strong, nonatomic, readonly, nullable) GTScrollNavigationBar *scrollNavigationBar;
@end
@implementation UINavigationController (GTScrollNavigationBarAdditions)
@dynamic scrollNavigationBar;
- (nullable GTScrollNavigationBar*)scrollNavigationBar
{
return [self.navigationBar isKindOfClass:[GTScrollNavigationBar class]] ? (GTScrollNavigationBar*)self.navigationBar : nil;
}
@end
Swift example:
self.navigationController?.scrollNavigationBar?.scrollView = self.tableView
Why do you check for (self.bounds.size.height * 2) at line 114 instead of just self.bounds.size.height? This seems to cause me issues on tableviews that are just slightly bigger then the screen, they start to scroll, and it starts to hide the nav bar, but the frame of the scrollview gets bigger (in setFrame) and the test then starts failing ,and my nav bar remains in a half hidden state until it is reset.
If I take out the multiply by two in the test it seems OK
I've modified the sample code to add some section headers, say after every 10 rows. All works fine if I stay within a single view controller, but if I scroll down the tableview, and then drill down into a new VC, and then come back, the tableview section header is rendered in the wrong place relative to the rest of the table cells. It appears to be offset by 64 pixels, the height of the Nav bar + status bar. Scrolling the tableview immediately fixes this problem.
It appears to be related to having automaticallyAdjustEdgeInsets set - Almost as if the top inset is being applied twice - Once automatically and once by the code, adding on an extra 64 pixels.
This effectively makes this code completely broken if you want to use section headers in multiple VCs pushed onto the same NavigationController
Hi, I've just recognized that the POD source are not at the current state! So please update it :)
If I push a view controller when on the bottom of the scrollview (tap cell 99 in the example), then go back by popping the pushed viewcontroller, when I try to scroll down there is a flickering on the navigation bar, and the bounce doesn't work correctly.
Hi,
I have a translucent tab bar, but i noticed that the calculations dont take this into account, its seen as the full content size, but really it should deduct the height of the bar. I believe its related to this line.
line 119:
if (self.scrollView.frame.size.height + (self.bounds.size.height * 2) >= self.scrollView.contentSize.height) {
We should check for a translucent tab bar so that we can reduce the scrollview frame size to account for this.
Hi there,
I have a issue with iPhone 6 and iOS 8.0.2.
My scenario:
When I try to refresh the content of the table view, before the refresh wheel completes its spin, navigation bar collapse on top. UIRefreshControl is flickery, when I drag down the view refresh control disappears, navigation bar closes itself and all the screen moves up.
Edit
This happens on iOS 7.1.2.
Any suggestion ?
Cheers
Layout breaks when the status bar is extended, "Personal Hotspot" for example.
I think scrollingnavigationbar should be nullable for use with Swift.
`
@interface UINavigationController (GTScrollNavigationBarAdditions)
@Property(strong, nonatomic, readonly, nullable) GTScrollNavigationBar *scrollNavigationBar;
@implementation UINavigationController (GTScrollNavigationBarAdditions)
@dynamic scrollNavigationBar;
@EnD
`
Swift example:
self.navigationController?.scrollNavigationBar?.scrollView = self.tableView
Hey, great tool! The pod spec has not been updated with the latest fixes. It would be awesome if you could update the spec.
ScrollNav bar doesn't works when use in collectionview under landscape mode which has a normal flow layout.
Please download the project from 'https://github.com/kirans/CollectionViewSample.git'. Launch the app in iPad potrait mode and rotate to landscape mode, the scroll nav bar occupies the whole screen
Is this not a supported feature?
Very nice lib, but I discovered a very rare behaviour.
I am using GTScrollNavigationBar with tableview. Sometimes when user scrolls down and a little bit up then taps on a cell (triggering push segue) push animation (and other animations like modal and pop) are being executed instantly. Any ideas?
If the NavigationItem.titleView have any information the scroll doesn't work. Left or Right itens works fine.
When you are on the first uitableview, if you scroll down, the navigation bar disappears. Then you click on a row, and the navigation bar is immediately shown, and then the sub view is pushed on.
Also, happens when you scroll the pushed view down and then pop it to its parent view.
I've looked at the code, but I do not see where you are calling resetToDefaultPosition
. I would have thought that it was either didSelectRowAtIndexPath
OR viewDidLoad
/viewWillAppear
/viewDidAppear
I'm not sure if this would look funky, but would like to test out how it looks. On the Facebook app when the navigation bar is hidden on the "News Feed", and then you click a post, it does NOT show the navigation bar on the "News Feed" view. And likewise, then when you pop the "Post" view, the "News Feed" view is shown again, and the navigation bar is still hidden.
Thanks,
PS: When I'm popping the view, i'm doing so via swipe right gesture, not using the button, as it is hidden...
When the scroll view is part of more subviews in the viewController view, the subiviews are moving with the navigation bar.
Hi,
I can see a lot of crashes in my Crashlytics reports, coming from
-[GTScrollNavigationBar setFrame:alpha:animated:] on the next line:
if(self.scrollView.superview).
All of this is being called from -[GTScrollNavigationBar resetToDefaultPosition:].
The crash says:
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000c.
I am calling the resetToDefault postion in - (void)viewWillDisappear:(BOOL)animated like so:
[self.navigationController.scrollNavigationBar resetToDefaultPosition:YES];
self.navigationController.scrollNavigationBar.scrollView = nil;
As the crashes are not always reproducible, could you please help me with some hints on how to treat it, or maybe tell me what could be the problem.
Thanks
Hi,
Why did you drop support for iOS 7 on your last v0.3? Is there any API reason?
Thanks for the great work besides that ๐
David
Hello,
I was using this lib now for a long time without a problem. I was using it in the ViewControllers mostly in Tabbars.
Today I wanted to normaly push a viewController but it always crashes on this line:
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
//This one:
self.navigationController.scrollNavigationBar.scrollView = self.tableView;
}
I tried calling the VC so:
UINavigationController *profileNavigationController = [[UINavigationController alloc]initWithNavigationBarClass:[GTScrollNavigationBar class] toolbarClass:nil];
[profileNavigationController setViewControllers:@[viewController]];
[self.navigationController pushViewController:profileNavigationController animated:YES];
and
UINavigationController *profileNavigationController = [[UINavigationController alloc]init];
[profileNavigationController setViewControllers:@[viewController]];
[self.navigationController pushViewController:profileNavigationController animated:YES];
It doesnt throw any exception. Just a error with a pointer to a memory address... Any help would be great.
The origin of the navigation bar look wrong every time the in_call status bar is open
http://jmp.sh/d59tNFU
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setTranslucent:NO];
[self setBarTintColor:[UIColor colorWithRed:1.00f green:0.26f blue:0.01f alpha:1.00f]];
[self setup];
}
return self;
}
navigationbar and tableview have a little bug.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.