Return to Snippet

Revision: 27893
at June 26, 2010 02:30 by cdnicoll


Initial Code
// NOTE: this uses place holders.
// PART 1 - update url of path to the image
// PART 2 - update the variable reference to the UIImageView object
// -----------------------------------------------

// ===== PART 1 =====
UIImage *imgURL = [[UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: @"${part 1 image path:http://www.example.com/img.jpg}"]]] retain];

if (imgURL != nil) { // Image was loaded successfully.
	// ===== PART 2 =====
	[${part 2 UIImageView Ref:myMainImg} setImage:imgURL];
	// ===== PART 2 =====
	[${part 2 UIImageView Ref:myMainImg} setUserInteractionEnabled:NO];
	[imgURL release]; // Release the image now that we have a UIImageView that contains it.
}

Initial URL

                                

Initial Description

                                

Initial Title
Load Image From URL

Initial Tags

                                

Initial Language
Objective C