XMRemoteImageController.m
Submitted by alex on Mon, 03/02/2009 - 07:05.
// // XMRemoteImageController.m // XMRemoteImage // // Created by Alex Clarke on 27/02/09. // Copyright 2009 CocoaLab Software Australia. All rights reserved. // #import "XMRemoteImageController.h" #import "XMImageDownloader.h" @implementation XMRemoteImageController @synthesize image1; @synthesize image2; - (id) init { self = [super init]; if (self != nil) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateImage:) name:kXMImageDownloadedNotification object:nil]; } return self; } - (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [super dealloc]; } -(void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSString * remotePath1 = @"http://www.machinecodex.com/media/test/test.tif"; NSString * proxyPath1 = [[NSBundle mainBundle] pathForResource:@"AudioCodex_1_0_64" ofType:@"png"]; XMImageDownloader * imageDownloader1 = [[[XMImageDownloader alloc] initWithProxyImagePath:proxyPath1 remoteImagePath:remotePath1 targetKey:@"image1"] autorelease]; [self setImage1:[imageDownloader1 image]]; NSString * remotePath2 = @"http://www.machinecodex.com/media/test/test.tif"; NSString * proxyPath2 = [[NSBundle mainBundle] pathForResource:@"cocoaLab-shadow48" ofType:@"png"]; XMImageDownloader * imageDownloader2 = [[[XMImageDownloader alloc] initWithProxyImagePath:proxyPath2 remoteImagePath:remotePath2 targetKey:@"image2"] autorelease]; [self setImage2:[imageDownloader2 image]]; } - (void) updateImage:(id)sender { NSDictionary * userInfo = [sender userInfo]; [self setValue:[sender object] forKey:[userInfo valueForKey:kXMTargetKey]]; } @end

Post new comment