This category makes it super easy to add a parallax header view to your table views. Other alternatives relies on subclassing of UITableViewController
or UITableView
. APParallaxHeader uses the Objective-C runtime instead to add the following method to UIScrollView
- (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height;
Add pod 'APParallaxHeader'
to your Podfile or pod 'APParallaxHeader', :head
if you're feeling adventurous.
Important note if your project doesn't use ARC: you must add the -fobjc-arc
compiler flag to UIScrollView+ APParallaxHeader.m
in Target Settings > Build Phases > Compile Sources.
- Drag the
APParallaxHeader/APParallaxHeader
folder into your project. - Import
UIScrollView+APParallaxHeader.h
(see sample Xcode project in /Demo
)
[tableView addParallaxWithImage:[UIImage imageNamed:@"ImageName"] andHeight:160];
- Ability to set a custom view as a ParallaxView
- Ability to customize the drop shadow size, opacity, color etc.
- Setting a minimum height
- Setting contentMode of the imageView
0.1.3
- Added an inner shadow
0.1.2
- Initial release
APParallaxHeader is brought to you by Mathias Amnell at Apping AB. The code is inspired by Sam Vermette's work with SVPullToRefresh (especially the usage of objc/runtime.h
to make it so easy to implement, without the need of subclassing).
APParallaxHeader is available under the MIT license. See the LICENSE file for more info.