TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Feb 2016 |
Maintained by Pin Shih Wang.
PWParallaxScrollView is a library for creating sliding menus with parallax effect inspired by the WWF app
#import "PWParallaxScrollView.h"
@interface ViewController <PWParallaxScrollViewDataSource>
- (NSInteger)numberOfItemsInScrollView:(PWParallaxScrollView *)scrollView;
- (UIView *)backgroundViewAtIndex:(NSInteger)index scrollView:(PWParallaxScrollView *)scrollView;
- (UIView *)foregroundViewAtIndex:(NSInteger)index scrollView:(PWParallaxScrollView *)scrollView;
self.scrollView = [[PWParallaxScrollView alloc] initWithFrame:self.view.bounds];
_scrollView.foregroundScreenEdgeInsets = UIEdgeInsetsMake(0, 30, 0, 100);
[self.view insertSubview:_scrollView atIndex:0];
- (UIView *)foregroundViewAtIndex:(NSInteger)index scrollView:(PWParallaxScrollView *)scrollView
{
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, 300, 70)];
...
return label;
}
self.scrollView = [[PWParallaxScrollView alloc] initWithFrame:self.view.bounds];
_scrollView.foregroundScreenEdgeInsets = UIEdgeInsetsZero;
[self.view insertSubview:_scrollView atIndex:0];
- (UIView *)foregroundViewAtIndex:(NSInteger)index scrollView:(PWParallaxScrollView *)scrollView
{
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, 300, 70)];
...
return label;
}
- (UIView *)foregroundViewAtIndex:(NSInteger)index scrollView:(PWParallaxScrollView *)scrollView
{
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, 300, 70)];
...
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
...
[button addTarget:self action:@selector(test) forControlEvents:UIControlEventTouchUpInside];
...
[label addSubview:button];
return label;
}
[scrollView moveToIndex:3];
[scrollView prevItem];
[scrollView nextItem];
- (UIView *)foregroundViewAtIndex:(NSInteger)index scrollView:(PWParallaxScrollView *)scrollView;
add delegate to receive touchScrollViewTapped event
- (void)parallaxScrollView:(PWParallaxScrollView *)scrollView didRecieveTapAtIndex:(NSInteger)index;
add interface builder support (initWithCoder, Outlets)
add PWParallaxDelegate and provides methods to check whether the current index is changed
PWParallaxScrollView is released under the MIT License (see the License file)
Any suggestions or improvements?
feel free to contact me