diff --git a/APParallaxHeader.podspec b/APParallaxHeader.podspec index 0f501a2..3260072 100644 --- a/APParallaxHeader.podspec +++ b/APParallaxHeader.podspec @@ -6,7 +6,7 @@ Pod::Spec.new do |s| s.summary = 'Add a parallax header view to your table views with one row of code.' s.homepage = 'https://github.com/apping/APParallaxHeader' s.author = { 'Mathias Amnell' => 'mathias@apping.se' } - s.source = { :git => 'https://github.com/apping/APParallaxHeader.git', :tag => s.version.to_s } + s.source = { :git => 'https://github.com/djbe/APParallaxHeader.git', :tag => s.version.to_s } s.description = '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. Instead, APParallaxHeader uses the Objective-C runtime to add the functionality to your UIScrollView or UITableView.' diff --git a/APParallaxHeader/UIScrollView+APParallaxHeader.h b/APParallaxHeader/UIScrollView+APParallaxHeader.h index c325004..262d596 100755 --- a/APParallaxHeader/UIScrollView+APParallaxHeader.h +++ b/APParallaxHeader/UIScrollView+APParallaxHeader.h @@ -34,6 +34,8 @@ typedef NS_ENUM(NSUInteger, APParallaxTrackingState) { @interface APParallaxView : UIView +- (id)initWithFrame:(CGRect)frame andShadow:(BOOL)shadow; + @property (weak) id delegate; @property (nonatomic, readonly) APParallaxTrackingState state; diff --git a/APParallaxHeader/UIScrollView+APParallaxHeader.m b/APParallaxHeader/UIScrollView+APParallaxHeader.m index 4494766..921d5a4 100755 --- a/APParallaxHeader/UIScrollView+APParallaxHeader.m +++ b/APParallaxHeader/UIScrollView+APParallaxHeader.m @@ -184,19 +184,19 @@ - (id)initWithFrame:(CGRect)frame andShadow:(BOOL)shadow { if(self = [super initWithFrame:frame]) { // default styling values - [self setAutoresizingMask:UIViewAutoresizingFlexibleHeight]; + [self setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth]; [self setState:APParallaxTrackingActive]; [self setAutoresizesSubviews:YES]; self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(frame), CGRectGetHeight(frame))]; - [self.imageView setAutoresizingMask:UIViewAutoresizingFlexibleHeight]; + [self.imageView setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth]; [self.imageView setContentMode:UIViewContentModeScaleAspectFill]; [self.imageView setClipsToBounds:YES]; [self addSubview:self.imageView]; if (shadow) { self.shadowView = [[APParallaxShadowView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(frame)-8, CGRectGetWidth(frame), 8)]; - [self.shadowView setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin]; + [self.shadowView setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleWidth]; [self addSubview:self.shadowView]; } } @@ -239,7 +239,7 @@ - (void)scrollViewDidScroll:(CGPoint)contentOffset { } else { [self setState:APParallaxTrackingActive]; } - + if(self.state == APParallaxTrackingActive) { CGFloat yOffset = contentOffset.y*-1; if ([self.delegate respondsToSelector:@selector(parallaxView:willChangeFrame:)]) { @@ -247,7 +247,7 @@ - (void)scrollViewDidScroll:(CGPoint)contentOffset { } [self setFrame:CGRectMake(0, contentOffset.y, CGRectGetWidth(self.frame), yOffset)]; - + if ([self.delegate respondsToSelector:@selector(parallaxView:didChangeFrame:)]) { [self.delegate parallaxView:self didChangeFrame:self.frame]; }