diff --git a/Example/AppDelegate.h b/Example/AppDelegate.h index 8aa046d..0241509 100644 --- a/Example/AppDelegate.h +++ b/Example/AppDelegate.h @@ -42,6 +42,7 @@ @interface AppDelegate : NSObject @property (strong) IBOutlet NSWindow *window; +@property (weak) IBOutlet NSTableView *tableView; @property (strong) IBOutlet NSArrayController *tweetsArrayController; @end diff --git a/Example/AppDelegate.m b/Example/AppDelegate.m index 3feb742..efb6d1e 100644 --- a/Example/AppDelegate.m +++ b/Example/AppDelegate.m @@ -60,6 +60,7 @@ @implementation AppDelegate @synthesize window = _window; +@synthesize tableView = _tableView; @synthesize tweetsArrayController = _tweetsArrayController; - (void)applicationDidFinishLaunching:(NSNotification *)notification { @@ -71,6 +72,10 @@ [Tweet publicTimelineTweetsWithBlock:^(NSArray *tweets) { self.tweetsArrayController.content = tweets; }]; + + [[NSNotificationCenter defaultCenter] addObserverForName:kUserProfileImageDidLoadNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) { + [self.tableView reloadData]; + }]; } - (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag { diff --git a/Example/Classes/Models/User.h b/Example/Classes/Models/User.h index 5f9f45c..f3ea855 100644 --- a/Example/Classes/Models/User.h +++ b/Example/Classes/Models/User.h @@ -22,6 +22,8 @@ #import +extern NSString * const kUserProfileImageDidLoadNotification; + @interface User : NSObject @property (readonly) NSUInteger userID; diff --git a/Example/Classes/Models/User.m b/Example/Classes/Models/User.m index 7c0d0a9..6f54c7f 100644 --- a/Example/Classes/Models/User.m +++ b/Example/Classes/Models/User.m @@ -23,6 +23,8 @@ #import "User.h" #import "AFImageRequestOperation.h" +NSString * const kUserProfileImageDidLoadNotification = @"com.alamofire.user.profile-image.loaded"; + @interface User () + (NSOperationQueue *)sharedProfileImageRequestOperationQueue; @end @@ -74,6 +76,8 @@ self.profileImage = image; _profileImageRequestOperation = nil; + + [[NSNotificationCenter defaultCenter] postNotificationName:kUserProfileImageDidLoadNotification object:self userInfo:nil]; }]; [_profileImageRequestOperation setCacheResponseBlock:^NSCachedURLResponse *(NSURLConnection *connection, NSCachedURLResponse *cachedResponse) { diff --git a/Example/Mac-Info.plist b/Example/Mac-Info.plist index 78c2117..fc1c1f6 100644 --- a/Example/Mac-Info.plist +++ b/Example/Mac-Info.plist @@ -25,7 +25,7 @@ LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright - Copyright © 2012年 __MyCompanyName__. All rights reserved. + Copyright © 2012年 Mattt Thompson. All rights reserved. NSMainNibFile MainMenu NSPrincipalClass diff --git a/Example/MainMenu.xib b/Example/MainMenu.xib index 5d713ef..6c47439 100644 --- a/Example/MainMenu.xib +++ b/Example/MainMenu.xib @@ -456,10 +456,6 @@ 67239424 33554432 - - NSImage - placeholder-stamp - LucidaGrande 13 @@ -539,7 +535,6 @@ {{1, 484}, {373, 15}} - _NS:1216 1 @@ -756,6 +751,14 @@ 609 + + + tableView + + + + 848 + value: arrangedObjects @@ -1978,7 +1981,7 @@ - 847 + 848 @@ -1990,11 +1993,13 @@ YES YES + tableView tweetsArrayController window YES + NSTableView NSArrayController NSWindow @@ -2003,11 +2008,16 @@ YES YES + tableView tweetsArrayController window YES + + tableView + NSTableView + tweetsArrayController NSArrayController @@ -2047,13 +2057,11 @@ YES NSMenuCheckmark NSMenuMixedState - placeholder-stamp YES {11, 11} {10, 3} - {50, 50} YES