A traditional-style scrollbar for iOS that integrates with existing UIScrollView or UIScrollView subclasses.
WKScrollBar draws a persistent scrollbar handle on top of a UIScrollView. When tapped and dragged,
WKScrollBar will scroll proportionately to its position on the screen. This comes in handy with apps which present long lists of items (
AQGridView, etc), as it makes it easy to navigate to any point in a list.
Installing via cocoapods is the preferred method of using
WKVerticalScrollBar. Simply add the following line to your
dependency 'WKVerticalScrollBar', '0.2.0'
WKVerticalScrollBar.m into your project. Make sure you've linked your project with
WKVerticalScrollBar is meant to integrate quickly with projects using
UIScrollView subclasses like
AQGridView. Getting started is easy:
- Create a
WKVerticalScrollBarinstance either in IB or in your
- Add the
WKVerticalScrollBarto the parent
UIView, making sure that it is the frontmost
UIVieweither by adding it last, or via
- Size the
WKVerticalScrollBarso that it takes up the same area as the
UIScrollViewthat it will manage.
UIScrollViewit will manage via
Modifying the look and feel of
WKScrollBar can be done via the following methods:
Sets a color for
UIControlStateSelectedto control the normal and selected (finger down) colors of the handle.
UIControlStateNormal: 40% black,
UIControlStateSelected: 60% black
Sets the width of the handle in the normal state.
Sets the width of the handle when selected. This allows you to grow the handle when the user's finger is over the handle.
Sets the width of the hit area for the handle. This will allow your control to have a slightly larger hit area than what is visually presented. Apple's iOS Human Interface Guidelines suggest that this be 44pt.
Sets the minimum height of the handle.
The height of the handle is calculated based upon the ratio of the
frame. If the
contentOffsetis too large, the handle may be too small to touch comfortably. Use this parameter to ensure that a minimum handle size is preserved.
Sets the corner radius of the handle in normal and selected mode.
Anyone who would like to contribute to the project is more than welcome. Basically, there's just a few steps to getting started:
- Fork this repo
- Make your changes
- Add yourself to the AUTHORS file and submit a pull request!
Copyright and License
WKVerticalScrollBar is Copyright (c) 2012 litl, LLC and licensed under the MIT license. See the LICENSE file for full details.