-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:likeapp/like-ios
- Loading branch information
Showing
13 changed files
with
272 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -609,6 +609,7 @@ | |
13B5B4F61B1710AE00252A78 /* LKTagCommentCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B5B4F51B1710AE00252A78 /* LKTagCommentCell.m */; }; | ||
13B6C1961AE8E8EA008912C0 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 13B6C1951AE8E8EA008912C0 /* [email protected] */; }; | ||
13B6C1991AE8EA9F008912C0 /* LKUserDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B6C1981AE8EA9F008912C0 /* LKUserDefaults.m */; }; | ||
13BB8DB51BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BB8DB41BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.m */; }; | ||
13BCA65E1B5CB28F00DC0549 /* LKPresentAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCA65D1B5CB28F00DC0549 /* LKPresentAnimation.m */; }; | ||
13BCA6611B5CCC7600DC0549 /* LKHomeHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCA6601B5CCC7600DC0549 /* LKHomeHeader.m */; }; | ||
13BCA6641B5CDCF200DC0549 /* LCBlurSearchBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCA6631B5CDCF200DC0549 /* LCBlurSearchBar.m */; }; | ||
|
@@ -1956,6 +1957,8 @@ | |
13B6C1951AE8E8EA008912C0 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; }; | ||
13B6C1971AE8EA9F008912C0 /* LKUserDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LKUserDefaults.h; sourceTree = "<group>"; }; | ||
13B6C1981AE8EA9F008912C0 /* LKUserDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LKUserDefaults.m; sourceTree = "<group>"; }; | ||
13BB8DB31BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+UIActivityIndicatorForSDWebImage.h"; sourceTree = "<group>"; }; | ||
13BB8DB41BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+UIActivityIndicatorForSDWebImage.m"; sourceTree = "<group>"; }; | ||
13BCA65C1B5CB28F00DC0549 /* LKPresentAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LKPresentAnimation.h; sourceTree = "<group>"; }; | ||
13BCA65D1B5CB28F00DC0549 /* LKPresentAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LKPresentAnimation.m; sourceTree = "<group>"; }; | ||
13BCA65F1B5CCC7600DC0549 /* LKHomeHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LKHomeHeader.h; sourceTree = "<group>"; }; | ||
|
@@ -3387,6 +3390,8 @@ | |
138EDD381AD7B0A30020957C /* Extension */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
13BB8DB31BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.h */, | ||
13BB8DB41BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.m */, | ||
138EDD391AD7B0A30020957C /* NSArray+LCExtension.h */, | ||
138EDD3A1AD7B0A30020957C /* NSArray+LCExtension.m */, | ||
138EDD3B1AD7B0A30020957C /* NSData+LCExtension.h */, | ||
|
@@ -5692,6 +5697,7 @@ | |
1377F04D1B5E35D8008E21BC /* WMLArrayDiffUtility.m in Sources */, | ||
13BCD8911ADBA92200A0CBF5 /* POPBasicAnimation.mm in Sources */, | ||
138EDE9F1AD7B0A30020957C /* UIView+LCGestureRecognizer.m in Sources */, | ||
13BB8DB51BA6EC32004AF98B /* UIImageView+UIActivityIndicatorForSDWebImage.m in Sources */, | ||
13E1A4EA1AE65FE300E24C3C /* FastttFocus.m in Sources */, | ||
138EDE261AD7B0A30020957C /* LCProcessInfo.m in Sources */, | ||
1390550D1B994A6D00DBF34A /* GPUImageLevelsFilter.m in Sources */, | ||
|
Binary file modified
BIN
+16.3 KB
(100%)
....xcodeproj/project.xcworkspace/xcuserdata/leer.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
LIKE/LIKE/LCFramework/Foundation/Extension/UIImageView+UIActivityIndicatorForSDWebImage.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// UIImageView+UIActivityIndicatorForSDWebImage.h | ||
// UIActivityIndicator for SDWebImage | ||
// | ||
// Created by Giacomo Saccardo. | ||
// Copyright (c) 2014 Giacomo Saccardo. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "UIImageView+WebCache.h" | ||
#import "SDImageCache.h" | ||
|
||
@interface UIImageView (UIActivityIndicatorForSDWebImage) | ||
|
||
@property (nonatomic, strong) UIActivityIndicatorView *activityIndicator; | ||
|
||
- (void)setImageWithURL:(NSURL *)url usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle; | ||
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle; | ||
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle; | ||
- (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle; | ||
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle; | ||
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle; | ||
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle; | ||
|
||
- (void)removeActivityIndicator; | ||
|
||
@end |
139 changes: 139 additions & 0 deletions
139
LIKE/LIKE/LCFramework/Foundation/Extension/UIImageView+UIActivityIndicatorForSDWebImage.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
// | ||
// UIImageView+UIActivityIndicatorForSDWebImage.m | ||
// UIActivityIndicator for SDWebImage | ||
// | ||
// Created by Giacomo Saccardo. | ||
// Copyright (c) 2014 Giacomo Saccardo. All rights reserved. | ||
// | ||
|
||
#import "UIImageView+UIActivityIndicatorForSDWebImage.h" | ||
#import <objc/runtime.h> | ||
#import "M13ProgressViewRing.h" | ||
|
||
static char TAG_ACTIVITY_INDICATOR; | ||
|
||
@interface UIImageView (Private) | ||
|
||
-(void)addActivityIndicatorWithStyle:(UIActivityIndicatorViewStyle) activityStyle; | ||
|
||
@end | ||
|
||
@implementation UIImageView (UIActivityIndicatorForSDWebImage) | ||
|
||
@dynamic activityIndicator; | ||
|
||
- (UIActivityIndicatorView *)activityIndicator { | ||
return (UIActivityIndicatorView *)objc_getAssociatedObject(self, &TAG_ACTIVITY_INDICATOR); | ||
} | ||
|
||
- (void)setActivityIndicator:(UIActivityIndicatorView *)activityIndicator { | ||
objc_setAssociatedObject(self, &TAG_ACTIVITY_INDICATOR, activityIndicator, OBJC_ASSOCIATION_RETAIN); | ||
} | ||
|
||
- (void)addActivityIndicatorWithStyle:(UIActivityIndicatorViewStyle)activityStyle { | ||
|
||
if (!self.activityIndicator) { | ||
self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:activityStyle]; | ||
|
||
self.activityIndicator.autoresizingMask = UIViewAutoresizingNone; | ||
|
||
[self updateActivityIndicatorFrame]; | ||
|
||
dispatch_async(dispatch_get_main_queue(), ^(void) { | ||
[self addSubview:self.activityIndicator]; | ||
}); | ||
} | ||
|
||
dispatch_async(dispatch_get_main_queue(), ^(void) { | ||
[self.activityIndicator startAnimating]; | ||
}); | ||
|
||
} | ||
|
||
-(void)updateActivityIndicatorFrame { | ||
if (self.activityIndicator) { | ||
CGRect activityIndicatorBounds = self.activityIndicator.bounds; | ||
float x = (self.frame.size.width - activityIndicatorBounds.size.width) / 2.0; | ||
float y = (self.frame.size.height - activityIndicatorBounds.size.height) / 2.0; | ||
self.activityIndicator.frame = CGRectMake(x, y, activityIndicatorBounds.size.width, activityIndicatorBounds.size.height); | ||
} | ||
} | ||
|
||
- (void)removeActivityIndicator { | ||
if (self.activityIndicator) { | ||
[self.activityIndicator removeFromSuperview]; | ||
self.activityIndicator = nil; | ||
} | ||
} | ||
|
||
-(void)layoutSubviews { | ||
[super layoutSubviews]; | ||
|
||
[self updateActivityIndicatorFrame]; | ||
} | ||
|
||
#pragma mark - Methods | ||
|
||
- (void)setImageWithURL:(NSURL *)url usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle { | ||
[self setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil usingActivityIndicatorStyle:activityStyle]; | ||
} | ||
|
||
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStye { | ||
[self setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil usingActivityIndicatorStyle:activityStye]; | ||
} | ||
|
||
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle{ | ||
[self setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil usingActivityIndicatorStyle:activityStyle]; | ||
} | ||
|
||
- (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle { | ||
[self setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock usingActivityIndicatorStyle:activityStyle]; | ||
} | ||
|
||
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle { | ||
[self setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock usingActivityIndicatorStyle:activityStyle]; | ||
} | ||
|
||
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle { | ||
[self setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock usingActivityIndicatorStyle:activityStyle]; | ||
} | ||
|
||
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock usingActivityIndicatorStyle:(UIActivityIndicatorViewStyle)activityStyle { | ||
|
||
// [self addActivityIndicatorWithStyle:activityStyle]; | ||
M13ProgressViewRing *ring = [[M13ProgressViewRing alloc] init]; | ||
ring.showPercentage = NO; | ||
ring.primaryColor = LKColor.color; | ||
ring.secondaryColor = LKColor.color; | ||
|
||
ring.viewFrameWidth = 50; | ||
ring.viewFrameHeight = 50; | ||
ring.viewFrameX = (self.viewFrameWidth - ring.viewFrameWidth) * 0.5; | ||
ring.viewFrameY = (self.viewFrameHeight - ring.viewFrameHeight) * 0.5; | ||
|
||
__weak typeof(self) weakSelf = self; | ||
[self sd_setImageWithURL:url | ||
placeholderImage:placeholder | ||
options:options | ||
progress:^(NSInteger receivedSize, NSInteger expectedSize) { | ||
|
||
if (progressBlock) { | ||
|
||
[ring setProgress:receivedSize * 1.0 / expectedSize animated:YES]; | ||
if (ring) { | ||
[ring removeFromSuperview]; | ||
} | ||
[weakSelf addSubview:ring]; | ||
} | ||
} | ||
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageUrl) { | ||
if (completedBlock) { | ||
completedBlock(image, error, cacheType, imageUrl); | ||
} | ||
[weakSelf removeActivityIndicator]; | ||
[ring removeFromSuperview]; | ||
} | ||
]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.