Giter Club home page Giter Club logo

toscrollbar's Introduction

TOScrollBar

TOScrollBar

CI Status CocoaPods Version GitHub license Platform Beerpay PayPal

TOScrollBar is a UI component that can be inserted into UIScrollView instances, allowing the user to traverse the entire scroll view in one swiping gesture.

It has been designed to appear and behave like a standard system control, and has been optimized to ensure it has minimal impact on scroll performance.

Features

  • Allows for fine-grained scrolling of a UIScrollView's entire content height.
  • Interoperates directly with UIScrollView through the Objective-C runtime and KVO.
  • Animates the same way as the standard scroll indicators (including rubber banding).
  • Exposes 44 points of horizontal touch space, so it is very easy to activate.
  • Tapping at different positions allows for instant traversal along the scroll view.
  • Plays a scrolling animation during slow swiping, making it easier to follow along.
  • Comes with initial style settings for dark themes.
  • Includes Taptic Engine impact effects in a similar style to UISlider, available on iPhone 7.

Examples

TOScrollBar has been designed to be added directly to a UIScrollView, not as a view above.

// Create a scroll bar object
TOScrollBar *scrollBar = [[TOScrollBar alloc] init];

// Add the scroll bar to our table view
[self.tableView to_addScrollBar:scrollBar];

//Adjust the table separators so they won't underlap the scroll bar
self.tableView.separatorInset = [self.tableView.to_scrollBar adjustedTableViewSeparatorInsetForInset:self.tableView.separatorInset];

Once added to a scroll view, a scroll bar can be accessed via the to_scrollBar property. Convienience methods are also applied to make it easier to configure the margins

Installation

TOScrollBar will work with iOS 7 and above. While written in Objective-C, it should easily import into Swift as well.

Manual Installation

Copy the contents of the TOScrollBar folder to your app project.

CocoaPods

pod 'TOScrollBar'

Carthage

Feel free to file a PR. :)

Why build this?

I'm building a comic reader app that allows users to group collections of comics into single view controllers.

Unfortunately, some users have reported that certain comic series have a very large number of issues. It doesn't make sense to break these issues out of their collections, but at the same time, traversing the comic has become a gruelling process.

This scroll bar is the first component in a series of upgrades I'm planning in an attempt to make navigation large comic collections more manageable.

Credits

TOScrollBar was created by Tim Oliver as a component of iComics.

License

TOScrollBar is available under the MIT license. Please see the LICENSE file for more information. analytics

toscrollbar's People

Contributors

arennow avatar keitaito avatar timoliver 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

toscrollbar's Issues

Support Large Titles in iOS 11

iOS 11 introduces the concept of 'large titles' in navigation bars as a way of indicating the landing screen in apps. When the scroll content moves, the navigation bar collapses into a normal looking one.

img_a945dd029c93-1

TOScrollBar originally relied on the assumption that the navigation bar wouldn't change height. As such, it will need to be updated to account for this.

I'm not too sure how I want to go about supporting this yet. Once the user starts manually dragging, the scroll bar can't change its height (That being the case, the section indexes in UITableView do that right now), so it may be a matter of dynamically adapting the size of the scroll bar to match the size of the navigation bar whenever the user isn't interacting with it.

Fix iOS 11.2 regression when tapping to jump

iOS 11.2 (or possibly earlier) has introduced a regression where tapping down on the track no longer instantly jumps to that section of the scroll view.

Current behavior is that the jump will occur after the user has lifted their finger, or will merely happen on its own after a second if the finger is left down.

This 'delayed' activity seems to imply it's the result of an internal gesture recognizer taking too long to release its control.

Since UIScrollView uses gesture recognizers internally, I'm GUESSING the best way to fix this is to wrap all of the scroll bar's interactions into a custom recognizer that can then be used to override the scroll view.

Jerky handle drag with handleExclusiveInteractionEnabled = true

  1. With handleExclusiveInteractionEnabled = true, when I grab the scroll bar handle, and drag my finger around quickly (on or away from the handle), it stops recognizing my finger's location, until I slow down a bit, and continue dragging near the handle's x-axis (without ever lifting my finger).

  2. When the flag is set to default false, it appears to behave as expected, but then you just have to drag around much faster to reproduce the above behaviour.

Reproducible on the example project with scrollBar.handleExclusiveInteractionEnabled = YES;.

Xcode 9.4
iOS 11.2.1 iPhone X
macOS 10.13.5

Custom Scroll bar is not showing in Swift 3

    self.myItemsTableView.showsVerticalScrollIndicator = true
    
    
    scrollBar.trackTintColor = UIColor.black
    scrollBar.trackWidth = 3.3
    
    myItemsTableView.to_add(scrollBar)

    myItemsTableView.indicatorStyle = UIScrollViewIndicatorStyle.black
    
   myItemsTableView.separatorInset = myItemsTableView.to_scrollBar!.adjustedTableViewSeparatorInset(forInset: myItemsTableView.separatorInset)]

this is how i added the control. If Im missing any code please help to fix the issue.

Scrollbar not showing up

I added TOScrollBar to my UITableView, but it's not showing. I subclassed a UITableView in my app and included it in there.

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, self.frame.size.height-144, self.frame.size.width, 40)];
    
        self.items = [@[] mutableCopy];
    
        self.delegate = self;
        self.dataSource = self;
        self.tableFooterView = footerView;
    
        TOScrollBar *scrollBar = [[TOScrollBar alloc] initWithStyle:TOScrollBarStyleDefault];
        [self to_addScrollBar:scrollBar];
        self.separatorInset = [scrollBar adjustedTableViewSeparatorInsetForInset:self.separatorInset];
    }
   return self;
}

Any ideas?

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.