GithubHelp home page GithubHelp logo

andreamazz / amscrollingnavbar Goto Github PK

View Code? Open in Web Editor NEW
6.1K 6.1K 626.0 22.95 MB

Scrollable UINavigationBar that follows the scrolling of a UIScrollView

License: MIT License

Ruby 2.66% Swift 95.81% Objective-C 1.54%

amscrollingnavbar's Introduction

๐Ÿ‘‹ Hey

I'm an iOS and Web developer, currently working at Fancy Pixel and as a freelancer. I mainly work with Swift (you'll find a bunch of iOS libraries used by many in my repos), but also work a lot with React for the web. Once I close my laptop I get into my workshop for some hand tools woodworking ๐Ÿ”จ

Get in touch

Want to collaborate on a new OSS project? Don't hesitate to contact me. I'm also available for freelance work on iOS.

โœ‰๏ธ

amscrollingnavbar's People

Contributors

abeansits avatar abohlsen avatar alexookah avatar allewun avatar andreamazz avatar apiyron avatar bobek-balinek avatar bryant1410 avatar dabeck avatar erikackermann avatar feef avatar genadyo avatar gitter-badger avatar hartlco avatar igor-palaguta avatar ikesyo avatar jeffreyjackson avatar jwolkovitz avatar m1entus avatar manuege avatar mark-dlc avatar mrdaios avatar oea avatar p-kislitskiy avatar readmecritic avatar romainbiard avatar rubencodes avatar tifroz avatar xzenon avatar zzz6519003 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amscrollingnavbar's Issues

not working with google ads

some odd issue, I tried to make it work with a web view.
when I Enabling the scrolling it's working great, but when I flip my device to horizontal my google ad disappear , is there any way to fix it ?

Temporarily disable scrolling

Whats the best way to temporary disable scrolling? I already tried to disable scrolling on my scrollview and setting followscrollview to nil but the navbar continues hiding.

ScrollableView frame problem after scrolling

Hi,

I found a problem in line 353 of your category:
frame.size.height = [UIScreen mainScreen].bounds.size.height - frame.origin.y;
In my case, the scrollable view is the content of a tab bar view controller. With the line above the scrollable view will be resized by ignoring the tab bar.

As improvement, I would appreciate if you could change this part like this (line numbers refers to commit eef1dbd)

  1. Line 40: New property for initial height of the scrollable view
- (void)setInitialScrollableViewHeight:(float)initialScrollableViewHeight { objc_setAssociatedObject(self, @selector(initialScrollableViewHeight), [NSNumber numberWithFloat:initialScrollableViewHeight], OBJC_ASSOCIATION_RETAIN); }
- (float)initialScrollableViewHeight { return [objc_getAssociatedObject(self, @selector(initialScrollableViewHeight)) floatValue]; }
  1. Line 50: Reset the height if followScrollView: is called
[self setInitialScrollableViewHeight:0.0f];
  1. Line 202: Save the height of the scrollable view's superview on first scrolling
if ([self initialScrollableViewHeight] == 0.0f) {
        [self setInitialScrollableViewHeight:self.scrollableView.superview.bounds.size.height];
}
  1. Line 353: Use initialScrollableViewHeight instead of [UIScreen mainScreen]
    if (frameNav.origin.y == [self statusBar]) {
        frame.size.height = [self initialScrollableViewHeight];
    } else {
        frame.size.height = [self initialScrollableViewHeight] + frameNav.size.height;
    }

Thank you!

CollectionView Issue

When I scroll up my, my entire CollectionView Y Cord scrolls up with it leaving a gap in the middle? This is a ViewController with a CollectionView in it.

It also sends a View (the button you see in the middle) its supposed to stay and not move. How can I make the button stay still when it scrolls?

oops

oops1

Panning gesture

Using the pan gesture to get back to the previous controller creates a gap between the nav bar and current controller.

Please refer to the screenshots from your demo.

ios simulator screen shot 25 mar 2014 15 24 26
ios simulator screen shot 25 mar 2014 15 24 37

nav bar items not fading out

Having a issue with my nag bar items still appearing a few pixels in the status bar and not getting the ease out animation when scrolling up

Update cocoa pod file

Can you update the specs file so that it'll point to the latest version with the fixes. Currently it uses 0.5.4 tag which is 2 months old:

s.source = { :git => "https://github.com/andreamazz/AMScrollingNavbar.git", :tag => '0.5.4' }

Thanks for you work!

What if no IBOutlet?

What if I programatically made a UITableViewController. There is no View where I can connect an IBOutlet for tableView, therefore

[self followScrollView:self.tableView]; --> will not work for me... how can I call this method in my case?

After scroll, the scrollview inset is wrong

Hi, I am using this in a UIViewController, as a child view controller of a uitabbarcontroller. After scroll, the tableView (root view in UITableviewController) will have an offset below the navigation bar. The extra space is about the height of the navigation bar. From Xcode, if I uncheck the Adjust Scroll View Insets checkbox for the view controller, the extra space will disappear after scroll, but the content section will go under the nav bar before the scroll.

To repro this, go with the instruction video, but after embedding the UIViewController with a navigation controller, connect this navigation controller to a UITabbarController. I am using the latest version 1.0, installed via cocoapod.

bug: The navigation bar dismiss sometimes

When I scroll up the scrollview, sometimes it works well. But sometimes my UIBarButtonItem didn't show correctly, in some case the navigation bar dismiss. I can not get the bar back when I scroll down.

Black gap in a subclass of AMScrollingNavbarTableViewController

amissue

Hey, thanks for the library, it's awesome. I'm facing an issue. On the gif above you can see 2 tables. 1st one is AMScrollingNavbarViewController with UITableView in it. And this one works great. 2nd is a UITableViewController deriving from AMScrollingNavbarTableViewController. This one creates a black gap, i think of size of the navigation bar. I setup the views in storyboard and except for standard data source things I did

[self followScrollView: self.tableView];

in viewDidLoad. Any hints about this problem?
Thanks in advance.

change UIViewController to UITableViewcontroller

hi all.
i'm testing AMScrollingNavbar in UITableViewController not UIViewController in UIViewController+ScrollingNavBar.h, m.
and some changes "AMTableViewController"
remove tableView Pointer, and delegate, something.

it's work fine in UINavigationController -> UITableViewController.(rootView)

but this is not work.
NavigationController -> TabBarViewController -> UITableViewController(Tab)
there are something Black Cells in top table.

did you experience this happen?

i'll send you my samples. can u test me?

please let me know your emails thanks!

Sometimes navigation items was not set alpha value correctly

If bar button item was not an array. Sometimes it wasn't set the alpha value correctly.
One that I encountered was their alpha value became 0.0f and even it was set back to 1.0f it's still invisible.

This is the original code.

- (void)updateNavbarAlpha:(CGFloat)delta
{
    ...
    [self.navigationItem.leftBarButtonItems enumerateObjectsUsingBlock:^(UIBarButtonItem* obj, NSUInteger idx, BOOL *stop) {
        obj.customView.alpha = alpha;
    }];
    [self.navigationItem.rightBarButtonItems enumerateObjectsUsingBlock:^(UIBarButtonItem* obj, NSUInteger idx, BOOL *stop) {
        obj.customView.alpha = alpha;
    }];
    ...
}

This is how I managed to fixed that.

- (void)updateNavbarAlpha:(CGFloat)delta
{
    ...
    [self.navigationItem.leftBarButtonItems enumerateObjectsUsingBlock:^(UIBarButtonItem* obj, NSUInteger idx, BOOL *stop) {
        obj.customView.alpha = alpha;
    }];
    self.navigationItem.leftBarButtonItem.customView.alpha = alpha;
    [self.navigationItem.rightBarButtonItems enumerateObjectsUsingBlock:^(UIBarButtonItem* obj, NSUInteger idx, BOOL *stop) {
        obj.customView.alpha = alpha;
    }];
    self.navigationItem.rightBarButtonItem.customView.alpha = alpha;
    ...
}

How to alway make scrollview indicator visible and stable.

I see the trick that hide the scrollview indicator jitter.
[[self scrollView] setShowsVerticalScrollIndicator:NO];

But compare the Instagram and Facebook. The indicator always visible.
Is there any way make things happen exactly like Instagram?

UITableView with UIRefreshControl

Nice project, congratulations!

I have problems when I use the UIRefreshControl in a UITableView.
In some cases the effect latch, but returns. In the other UITableView disappears.

It would also be interesting if there was an option to remove the followScrollView.

I dont know if there's interest in it responds to iOS 6 in cases where the app has status bar fixed.

Add tap recognizer and support for tabbars

Is it possible to add a tap gesture recognizer to show the navbar if the user taps the status bar? Also, when using this with a view controller in a tabbar, there is an offset in the origin.y of the frame, I have attempted a fix, but it's not going very well, so if you have any suggestions, that'd be great! Thanks!

Panning gesture

It would be good to have a feature that blocks the pan gesture on the X-axis when a user let's say pans on the Y-axis and the navbar hides. One pan gesture at a time.

UITableViewController "out of box" install yields black gap

Hi, thanks for this great library. ๐Ÿ‘

I couldn't find any documentation on using the project with UITableViewController, and when I use it with a table view controller "out of the box":

[self followScrollView:self.tableView]

there is a 64px gap added to the frame as soon as I start scrolling.

  1. How do I get rid of that gap?
  2. Since this is likely the most common integration scenario, it seems like documentation should exist for this.

bar button items are tinted when there is no scroll view to follow

I haven't completely nailed this down yet but it seems to be tinting (or maybe partially obscuring with the tinted layer?) the left and right bar button items on the navigation controller's push and pop events. Seems to only happen when I'm not following any scroll view. I'll try to get more info.

Update: this doesn't happen in 0.5.2 (Haven't tried 0.5.3 yet -- was using :head)

Working with a subclassed UiTableViewController

Hello,

The sample tableview controller sample uses AMScrollingNavBar which is itself a UIViewController.

Before I try and look under the hood, just how feasible do you think it would be to get it working with my subclassed UITableViewController:

(master class which is a UITableViewController)
CoreDataTableViewController ->
(sub class of CoreDataTableViewController)
UsesTableViewController

any thoughts?

thank you.

Insets problem with scrollViewShouldScrollToTop:

When you set insets in code to fulfil you needs (e.g. extend under UITabBar) scrollViewShouldScrollToTop: method stops working when you scroll to the bottom of UITableView.
In my code I've set [self.tableView setContentInset:UIEdgeInsetsMake(0, 0, 44, 0)]; because last row of UITableView was missing and this bug occurred. Also, when you set Adjust Scroll View Insets the same bug appears.

I don't know how to make all rows visible and keep scrollViewShouldScrollToTop: working everytime?

sending app to background causes issues with nav bar and scroll view

When I have my nav bar in a collapsed state and then send my app to the background (for example, press the home button) then bring my app back - the nav bar is displayed. However the tinted bar is still covering the title AND my scroll view now goes behind the nav bar. navigating away and back to the same view fixes it.

installed via cocoapods - version 0.5.1 (also tested in 0.5)

Push segue animation issue

I'm using AMScrollingNavbar in iOS 7 to hide the navigation bar when scrolling in a UITableView. However, when I tap on a cell's header to segue to a new view controller, the navigation bar of the destination view controller does a resize animation to 64px (44px navigation title bar + 20px status bar) and it's very noticeable. When I pop back to the first view controller, the navigation bar maintains that 64px, and not the 20px (only the status bar) it originally had before the segue.

Is there a way to prevent this or is this a bug?

Should add some code in - (void)scrollWithDelta:(CGFloat)delta

It is just several lines, so I didn't submit a request.

The isExpanded and isCollapsed should be set to NO when the following situation happening.

- (void)scrollWithDelta:(CGFloat)delta
{
    CGRect frame;

    if (delta > 0) {

        if (self.isExpanded) {
            self.isExpanded = NO;
        }
        ...
    }

    if (delta < 0) {

        if (self.isCollapsed) {
            self.isCollapsed = NO;
        }
        ...
    }
}

uisearchbar in wrong position

Hi, I got some problems when trying to add search bar above table view

photo 1

photo 2

I've no idea how to fix it, can you help me?

thanks for your help

What's if no StatusBar?

My application do not show the status bar on top, that brings some weird issue? how can i fix this?

Twitchy scroll indicator

First of all, this library is awesome and thanks a lot for sharing it with community!

I've found a little but confusing bug (devil is in the detail). Here is a little description:
When you scroll down and AMScrollingNavbar starts hiding (you have to do it slowly) and you gently move your finger in other direction (left or right) but still keep scrolling down you'll face a little twitching of scroll indicator.

I've also tested your demo app and it is facing the same issue. For a better visiualization (I hope becuse the movie quality is poor) take a look at this movie.

I suggest you test it by yourself! And answer me if you've also had the same problem or maybe a solution! I know you can always hide scroll indicator but it's nice to show user when he currently is :)

View show under nav bar in non-autolayout mode

I don't know is it a bug, but below findings

  • (void)showNavbar

if (self.scrollableView != nil) {
if (self.isCollapsed) {
CGRect rect;
if ([self.scrollableView isKindOfClass:[UIWebView class]]) {
rect = ((UIWebView*)self.scrollableView).scrollView.frame;
} else {
rect = self.scrollableView.frame;
}

        NSLog(@"%f", rect.origin.y);

        // problem here            
            //(x, y) = (0. -64)
            //(w, h) = (320,563)
            // Non-Auto Layout

            //(x, y) = (0. 0)
            //(w, h) = (320,499)
            // Auto layout

Extra space (like the navigatioBar height)

Hi,
It should be out off topic.
When I add the library to my VC and start scrolling the tableview an extra space appears between the status bar and my tableview.
I don't use storyboard neither xib , and I suspect it's due to the constraints.
Could you tell me how can I add them by code?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.