Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 161f537d0e | |||
| 38c37e33e1 | |||
| 273b0a378b |
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = 'PNTwitterCover'
|
s.name = 'PNTwitterCover'
|
||||||
s.version = '1.0.1'
|
s.version = '1.0.3'
|
||||||
s.summary = 'PNTwitterCover is a UUIscrollView Category to add blur and zoom during scroll bounce'
|
s.summary = 'PNTwitterCover is a UUIscrollView Category to add blur and zoom during scroll bounce'
|
||||||
|
|
||||||
# This description is used to generate tags and improve search results.
|
# This description is used to generate tags and improve search results.
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
@property (nonatomic, strong) NSMutableArray *blurImages;
|
@property (nonatomic, strong) NSMutableArray *blurImages;
|
||||||
@property (nonatomic, strong) UIView *topView;
|
@property (nonatomic, strong) UIView *topView;
|
||||||
@property (nonatomic) CGFloat height;
|
@property (nonatomic) CGFloat height;
|
||||||
|
@property (nonatomic) CGFloat width;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@ -32,6 +33,7 @@
|
|||||||
_blurImages = [[NSMutableArray alloc] initWithCapacity:20];
|
_blurImages = [[NSMutableArray alloc] initWithCapacity:20];
|
||||||
_topView = view;
|
_topView = view;
|
||||||
_height = frame.size.height;
|
_height = frame.size.height;
|
||||||
|
_width = frame.size.width;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -46,12 +48,15 @@
|
|||||||
|
|
||||||
- (void)prepareForBlurImages
|
- (void)prepareForBlurImages
|
||||||
{
|
{
|
||||||
CGFloat factor = 0.1;
|
|
||||||
[_blurImages addObject:self.image];
|
[_blurImages addObject:self.image];
|
||||||
for (NSUInteger i = 0; i < 20; i++) {
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
||||||
[_blurImages addObject:[self.image boxblurImageWithBlur:factor]];
|
CGFloat factor = 0.1;
|
||||||
factor+=0.04;
|
for (NSUInteger i = 0; i < 20; i++) {
|
||||||
}
|
[_blurImages addObject:[self.image boxblurImageWithBlur:factor]];
|
||||||
|
factor+=0.04;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setScrollView:(UIScrollView *)scrollView
|
- (void)setScrollView:(UIScrollView *)scrollView
|
||||||
@ -75,9 +80,9 @@
|
|||||||
if (self.scrollView.contentOffset.y < 0) {
|
if (self.scrollView.contentOffset.y < 0) {
|
||||||
|
|
||||||
CGFloat offset = -self.scrollView.contentOffset.y;
|
CGFloat offset = -self.scrollView.contentOffset.y;
|
||||||
_topView.frame = CGRectMake(0, -offset, 320, _topView.bounds.size.height);
|
_topView.frame = CGRectMake(0, -offset, _width, _topView.bounds.size.height);
|
||||||
|
|
||||||
self.frame = CGRectMake(-offset,-offset + _topView.bounds.size.height, 320+ offset * 2, _height + offset);
|
self.frame = CGRectMake(-offset,-offset + _topView.bounds.size.height, _width+ offset * 2, _height + offset);
|
||||||
NSInteger index = offset / 10;
|
NSInteger index = offset / 10;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
index = 0;
|
index = 0;
|
||||||
@ -92,9 +97,9 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_topView.frame = CGRectMake(0, 0, 320, _topView.bounds.size.height);
|
_topView.frame = CGRectMake(0, 0, _width, _topView.bounds.size.height);
|
||||||
|
|
||||||
self.frame = CGRectMake(0,_topView.bounds.size.height, 320, _height);
|
self.frame = CGRectMake(0,_topView.bounds.size.height, _width, _height);
|
||||||
UIImage *image = _blurImages[0];
|
UIImage *image = _blurImages[0];
|
||||||
|
|
||||||
if (self.image != image) {
|
if (self.image != image) {
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
- (void)addTwitterCoverWithImage:(UIImage*)image;
|
- (void)addTwitterCoverWithImage:(UIImage*)image;
|
||||||
- (void)addTwitterCoverWithImage:(UIImage*)image withTopView:(UIView*)topView;
|
- (void)addTwitterCoverWithImage:(UIImage*)image withTopView:(UIView*)topView;
|
||||||
|
- (void)addTwitterCoverWithImage:(UIImage*)image withTopView:(UIView*)topView andHeight:(CGFloat) height;
|
||||||
- (void)addTwitterCoverWithImage:(UIImage*)image withTopView:(UIView*)topView width:(CGFloat) width andHeight:(CGFloat) height;
|
- (void)addTwitterCoverWithImage:(UIImage*)image withTopView:(UIView*)topView width:(CGFloat) width andHeight:(CGFloat) height;
|
||||||
- (void)removeTwitterCoverView;
|
- (void)removeTwitterCoverView;
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,10 @@ static char UIScrollViewTwitterCover;
|
|||||||
[self addTwitterCoverWithImage:image withTopView:topView width:[UIScreen mainScreen].bounds.size.width andHeight:DefaultTwitterCoverViewHeight];
|
[self addTwitterCoverWithImage:image withTopView:topView width:[UIScreen mainScreen].bounds.size.width andHeight:DefaultTwitterCoverViewHeight];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)addTwitterCoverWithImage:(UIImage*)image withTopView:(UIView*)topView andHeight:(CGFloat) height {
|
||||||
|
[self addTwitterCoverWithImage:image withTopView:topView width:[UIScreen mainScreen].bounds.size.width andHeight:height];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)addTwitterCoverWithImage:(UIImage*)image withTopView:(UIView*)topView width:(CGFloat) width andHeight:(CGFloat) height
|
- (void)addTwitterCoverWithImage:(UIImage*)image withTopView:(UIView*)topView width:(CGFloat) width andHeight:(CGFloat) height
|
||||||
{
|
{
|
||||||
PNTwitterCoverView *view = [[PNTwitterCoverView alloc] initWithFrame:CGRectMake(0,0, width, height) andContentTopView:topView];
|
PNTwitterCoverView *view = [[PNTwitterCoverView alloc] initWithFrame:CGRectMake(0,0, width, height) andContentTopView:topView];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user