CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Dec 2014 |
Maintained by Pavel Dusatko.
PADTiltViewController adds device tilt capability to one directional scroll views on iOS.
Link to video: Youtube
PADTiltViewController is available on CocoaPods. Just add the following line to your project Podfile:
pod 'PADTiltViewController'Alternatively, you can manually add the files into your Xcode project.
PADTiltViewController uses CoreMotion framework to detect tilt gesture.
Start by subclassing PADTiltCollectionViewController, PADTiltScrollViewController or PADTiltTableViewController based on your application design.
#import <PADTiltViewController/PADTiltViewController.h>
@interface PADTiltTableViewControllerExample : PADTiltTableViewController
@endYour application should create only a single instance of the CMMotionManager class. Multiple instances of this class can affect the rate at which an application receives data from the accelerometer and gyroscope.
Set pad_motionManager property to reference this instance (ideally in viewDidLoad).
- (void)viewDidLoad {
[super viewDidLoad];
self.pad_motionManager = [(PADAppDelegate *)[[UIApplication sharedApplication] delegate] motionManager];
}PADTiltScrollViewController requires you to manually provide an instance of UIScrollView, UITableView or UICollectionView and assign it to scrollView property. You can do this either programmatically or using storyboard/xib file.
- (void)viewDidLoad {
[super viewDidLoad];
self.scrollView = self.collectionView;
}Optionally you can also set the preferred tilt direction.
// Horizontal collection view
self.pad_tiltDirection = PADTiltDirectionHorizontal;Start tilt updates by calling pad_startReceivingTiltUpdates.
- (void)startReceivingTiltUpdates {
[self pad_startReceivingTiltUpdates];
// Custom logic goes here
}Stop tilt updates by calling pad_stopReceivingTiltUpdates.
- (void)stopReceivingTiltUpdates {
[self pad_stopReceivingTiltUpdates];
// Custom logic goes here
}There's also an example project. In the example, you can tilt vertical table views and a horizontal collection view.
PADTiltViewController uses PADTiltAdditions category on UIViewController in conjunction with associated objects to extend the behavior of UIViewController, UICollectionViewController and UITableViewController.
See the CONTRIBUTING.md file for how to help out.
PADTiltViewController is released under a MIT License. See LICENSE file for details.