andreamazz / AMScrollingNavbar

Scrollable UINavigationBar that follows the scrolling of a UIScrollView
MIT License
6.05k stars 633 forks source link

Fully Hide Follower(s) and content inset issues #335

Open StainlessStlRat opened 6 years ago

StainlessStlRat commented 6 years ago

Describe the bug I am replacing TLYShyNavBarManager with your library and liking it very much! However, I'm not sure I understand how to to use it correctly.

I have a UIViewController that has a full screen tableView. I create a custom toolbar programmatically and add it as a subview to self.view (I suspect herein lies my content inset issue. With TLY, I didn't have to add it to self.view)

Everything works GREAT except:

1) The toolbar I have set as a follower does not fully hide. I can actually live with this until a future update. 2) The toolbar covers up some of the underlying tableview. This I have to fix ASAP.

Relevant code:

//Creating of toolbar
_statusBar = [[StatusBar alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width, 130.0)];
_statusBar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_statusBar.searchBar.delegate = self; //Implement search bar delegate features
[self.view addSubview:_statusBar];

//Attaching/Following
NavigationBarFollower *statusBarFollow = [[NavigationBarFollower alloc] initWithView:_statusBar direction:NavigationBarFollowerCollapseDirectionScrollUp];
[(ScrollingNavigationController *)self.navigationController followScrollView:_tableView delay:0 scrollSpeedFactor:1 collapseDirection:NavigationBarCollapseDirectionScrollDown followers:@[statusBarFollow]];

Here is a video demonstrating my issue! https://imgur.com/a/hWmjgrf

In the video, my "toolbar" is the thing from the bottom of the nav bar all the way to the "games shown" stuff

Any help would be greatly appreciated! And thanks for the library!

StefaniOSApps commented 6 years ago

Do not use

if (@available(iOS 11.0, *)) {
          [table setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
}
StainlessStlRat commented 6 years ago

Thanks Stefani, I already checked and I am not using that (though that was being called in the old TLYShyNav lib)

StainlessStlRat commented 6 years ago

I updated my project to create the "toolbar" in storyboard (instead of programmatically) with constraints set to have the top of the tableview to be constrained to the bottom of my toolbar.

It makes it so the tableview isn't covered up, but now when scrolling up their is an empty space.

Here is a video https://imgur.com/a/fnF2GsU

StefaniOSApps commented 6 years ago

the best way is to make a sample project and upload it on GitHub. Yes, this framework has some issues, including the gaps. I have now noticed a new issue, then I will post with a demo project.

StainlessStlRat commented 6 years ago

I will gladly create a demo project if it is helpful. Just want to make sure I’m not doing something wrong.

StefaniOSApps commented 6 years ago

That will be the best. You can also test my creation of the framework. There are some errors already fixed. Also make sure you have set translucens to true.

StainlessStlRat commented 6 years ago

I ran your demo last night. For whatever reason for me the performance was very bad, even in release mode. Ill try again tonight.

StefaniOSApps commented 6 years ago

In the Demo Projet I have outsourced the framework from cocoapod. Only so could see in messages of the terminal.

https://github.com/StefaniOSApps/Example

or use

pod 'AMScrollingNavbar',
  :git => 'https://github.com/StefaniOSApps/AMScrollingNavbar.git'#,
  #:branch => 'master'
StainlessStlRat commented 6 years ago

https://github.com/StainlessStlRat/ScrollBarDemo

It doesn't behave precisely like my app does during integration, but close enough to demonstrate the issue with the gap and not hiding the follower.

Please let me know if there is anything else I can do to help.

StefaniOSApps commented 6 years ago

the content inset can you see here:

bildschirmfoto 2018-10-19 um 21 57 44

I think the hight of UITableView is fix.

StainlessStlRat commented 6 years ago

How can I go about fixing that? Shouldn’t it be an offset/inset that is passed in by the scroll manager?

Also what about the follower not hiding?

StainlessStlRat commented 6 years ago

And how do you look at the interface that way? :)

StainlessStlRat commented 6 years ago

Here is an example of the functionality I need to replace (old version of my app integrated with TLYShyNavBar) https://imgur.com/a/UTs1HGf

You can see the follower hides first, then the nav bar.

StefaniOSApps commented 6 years ago

solved on https://github.com/StefaniOSApps/Example/issues/1#issuecomment-431606120

StainlessStlRat commented 5 years ago

Hello, just checking in again.

If the author gets a chance, can you let me know whether or not this is a bug or if it’s just something that the library wasn’t designed for etc...

I can understand if you don’t have time to fix it, but just understanding whether or not it is truly a bug would be helpful.

andreamazz commented 5 years ago

Let me check

andreamazz commented 5 years ago

Ok, I'm reading back the issue, in the end your request is, if I understand corectly, how to implement this behaviour: https://imgur.com/a/UTs1HGf

The followers feature works the other way around, they follow the navbar while it's scrolling away, but they remain on screen at all times. On top of my head I think you can recreate that effect by serving the header view inside the cell at indexpath 0,0, and use the scroll delay feature to account for its height.

andreamazz commented 5 years ago

Here, like this: ScrollBarDemo.zip

StainlessStlRat commented 5 years ago

Hey thank you andremazz!! I will look at your demo and look at replacing the one I use with yours again. I realllllllly hope I can get it working because the library I'm using is no longer in development.

StainlessStlRat commented 5 years ago

Hello andreamazz, I checked out your demo but unfortunately it's not quite what I'm after. If you look closely at the Imgur gif, the toolbar underneath the navbar can be visible at any index. So you could be at cell 500 for example, pull down a little and the toolbar will still pop up.

If you have a moment, maybe you can download my app @ https://itunes.apple.com/us/app/gameye/id1105342771?mt=8 and see how it currently works to see if it's possible to implement with your library?

Just open the app, click on games, and go to the encyclopedia tab and scroll around. I would absolutely LOVE to replace it's implementation with yours, and if this functionality isn't currently in the library, I think your users would find it quite useful!

andreamazz commented 5 years ago

Ok, I see what you mean, let me think about it. Btw, the scrolling sometimes is janky on an iPhone XS, it feels like the app is calling networking code on the main thread. Out of curiosity, what are you using to download images?

StainlessStlRat commented 5 years ago

It's probably installing first time use data and unzipping it or something. I bet it's smooth now :) For the image streaming I'm using sd stream I think it's called?

StainlessStlRat commented 5 years ago

So I finally figured out that the library I have been using is occasionally crashing via OOM, which Crashylytics doesn't catch. Hopefully you figure something out!

andreamazz commented 5 years ago

Yep, I'm working on this feature. It's not straightforward to implement, it might take a while.

StainlessStlRat commented 5 years ago

That’s great news!!!! I was able to patch the oom, but it’s hack on hack on hack so I cant wait for your version!

andreamazz commented 5 years ago

Hey @StainlessStlRat I'm still working on it, it's taking longer than I thought :)

StainlessStlRat commented 5 years ago

I’m glad youre working on it!!

StainlessStlRat commented 5 years ago

How's it coming along? Any progress?

andreamazz commented 5 years ago

I'm a bit swamped between work and moving from my old apartment. I can push the current state on a separate branch, any help is welcome.

andreamazz commented 5 years ago

Checkout branch header

X901 commented 5 years ago

Any update ? I faced same issue

https://cl.ly/f272f705d050

StainlessStlRat commented 5 years ago

Any progress? I don't mind looking at the branch, but is there certain issues you're facing?

StainlessStlRat commented 5 years ago

Any updates?

StainlessStlRat commented 4 years ago

Just checking in to see if there’s any progress?

andreamazz commented 4 years ago

Hey @StainlessStlRat sorry for the delay, I'm currently unable to work on this. There is a partial implementation in the header branch, any help is welcome.