Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
Removing Image Manager, skipping the middle-man, and using just AFNet…
Browse files Browse the repository at this point in the history
…working instead
  • Loading branch information
mattt committed Oct 31, 2011
1 parent 0ed6aca commit 12fce97
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 184 deletions.
6 changes: 0 additions & 6 deletions IOSBoilerplate.xcodeproj/project.pbxproj
Expand Up @@ -46,7 +46,6 @@
09885EC31418F2E600CCE17A /* IOSBoilerplateTests.h in Resources */ = {isa = PBXBuildFile; fileRef = 09885EC21418F2E600CCE17A /* IOSBoilerplateTests.h */; };
09885EC51418F2E600CCE17A /* IOSBoilerplateTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 09885EC41418F2E600CCE17A /* IOSBoilerplateTests.m */; };
09885EF91418F4AB00CCE17A /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 09885EF81418F4AB00CCE17A /* BaseViewController.m */; };
09885F381418F73A00CCE17A /* ImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 09885F371418F73A00CCE17A /* ImageManager.m */; };
09885F3C1418FC6F00CCE17A /* HTTPHUDExample.m in Sources */ = {isa = PBXBuildFile; fileRef = 09885F3A1418FC6E00CCE17A /* HTTPHUDExample.m */; };
09885F3D1418FC6F00CCE17A /* HTTPHUDExample.xib in Resources */ = {isa = PBXBuildFile; fileRef = 09885F3B1418FC6E00CCE17A /* HTTPHUDExample.xib */; };
09885F421418FFE000CCE17A /* SVProgressHUD.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 09885F3F1418FFE000CCE17A /* SVProgressHUD.bundle */; };
Expand Down Expand Up @@ -162,8 +161,6 @@
09885EF11418F44200CCE17A /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
09885EF71418F4AB00CCE17A /* BaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseViewController.h; sourceTree = "<group>"; };
09885EF81418F4AB00CCE17A /* BaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseViewController.m; sourceTree = "<group>"; };
09885F361418F73A00CCE17A /* ImageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageManager.h; sourceTree = "<group>"; };
09885F371418F73A00CCE17A /* ImageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageManager.m; sourceTree = "<group>"; };
09885F391418FC6E00CCE17A /* HTTPHUDExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPHUDExample.h; sourceTree = "<group>"; };
09885F3A1418FC6E00CCE17A /* HTTPHUDExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HTTPHUDExample.m; sourceTree = "<group>"; };
09885F3B1418FC6E00CCE17A /* HTTPHUDExample.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HTTPHUDExample.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -420,8 +417,6 @@
children = (
09885EF71418F4AB00CCE17A /* BaseViewController.h */,
09885EF81418F4AB00CCE17A /* BaseViewController.m */,
09885F361418F73A00CCE17A /* ImageManager.h */,
09885F371418F73A00CCE17A /* ImageManager.m */,
09885F46141901E700CCE17A /* DictionaryHelper.h */,
09885F47141901E700CCE17A /* DictionaryHelper.m */,
09885F5714190D7900CCE17A /* FastCell.h */,
Expand Down Expand Up @@ -635,7 +630,6 @@
09885EA51418F2E600CCE17A /* IOSBoilerplateAppDelegate.m in Sources */,
09885EAB1418F2E600CCE17A /* RootViewController.m in Sources */,
09885EF91418F4AB00CCE17A /* BaseViewController.m in Sources */,
09885F381418F73A00CCE17A /* ImageManager.m in Sources */,
09885F3C1418FC6F00CCE17A /* HTTPHUDExample.m in Sources */,
09885F431418FFE000CCE17A /* SVProgressHUD.m in Sources */,
09885F48141901E700CCE17A /* DictionaryHelper.m in Sources */,
Expand Down
11 changes: 6 additions & 5 deletions IOSBoilerplate/AsyncCell.m
Expand Up @@ -27,8 +27,8 @@
//

#import "AsyncCell.h"
#import "ImageManager.h"
#import "DictionaryHelper.h"
#import "AFImageRequestOperation.h"

@implementation AsyncCell

Expand Down Expand Up @@ -92,12 +92,13 @@ - (void) drawContentView:(CGRect)rect {

- (void) updateCellInfo:(NSDictionary*)_info {
self.info = _info;
NSString* url = [info stringForKey:@"profile_image_url"];
if (url) {
[ImageManager loadImage:url success:^(UIImage* img) {
self.image = img;
NSString *urlString = [info stringForKey:@"profile_image_url"];
if (urlString) {
AFImageRequestOperation *operation = [AFImageRequestOperation imageRequestOperationWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]] success:^(UIImage *requestedImage) {
self.image = requestedImage;
[self setNeedsDisplay];
}];
[operation start];
}
}

Expand Down
8 changes: 2 additions & 6 deletions IOSBoilerplate/AsyncImageExample.m
Expand Up @@ -27,7 +27,7 @@
//

#import "AsyncImageExample.h"
#import "ImageManager.h"
#import "UIImageView+AFNetworking.h"

@implementation AsyncImageExample

Expand Down Expand Up @@ -68,11 +68,7 @@ - (void)viewDidUnload
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];

NSString* url = @"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/Zaragoza_shel.JPG/266px-Zaragoza_shel.JPG";
[ImageManager loadImage:url success:^(UIImage* img) {
imageView.image = img;
}];

[self.imageView setImageWithURL:[NSURL URLWithString:@"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/Zaragoza_shel.JPG/266px-Zaragoza_shel.JPG"]];
}

- (void)viewDidAppear:(BOOL)animated {
Expand Down
3 changes: 0 additions & 3 deletions IOSBoilerplate/IOSBoilerplateAppDelegate.m
Expand Up @@ -27,7 +27,6 @@
//

#import "IOSBoilerplateAppDelegate.h"
#import "ImageManager.h"
#import "AFURLCache.h"
#import "BrowserViewController.h"

Expand Down Expand Up @@ -100,11 +99,9 @@ - (void)applicationWillTerminate:(UIApplication *)application
Save data if appropriate.
See also applicationDidEnterBackground:.
*/
[ImageManager releaseSingleton];
}

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
[ImageManager clearMemoryCache];
}

- (void)dealloc
Expand Down
50 changes: 0 additions & 50 deletions IOSBoilerplate/ImageManager.h

This file was deleted.

113 changes: 0 additions & 113 deletions IOSBoilerplate/ImageManager.m

This file was deleted.

1 change: 0 additions & 1 deletion IOSBoilerplate/VariableHeightCell.m
Expand Up @@ -27,7 +27,6 @@
//

#import "VariableHeightCell.h"
#import "ImageManager.h"
#import "DictionaryHelper.h"

@implementation VariableHeightCell
Expand Down

0 comments on commit 12fce97

Please sign in to comment.