XMRemoteImageController.m

//
//  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

The content of this field is kept private and will not be shown publicly.
Enter the code shown in the image:

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
10 + 3 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Donate!





If you like what you find here and wish to support further development of this site, please donate via PayPal. No account required.

Syndicate

Syndicate content

User login

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
3 + 6 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
Enter the code shown in the image: