Skip to content

Instantly share code, notes, and snippets.

@hanksudo
Created March 8, 2011 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanksudo/859846 to your computer and use it in GitHub Desktop.
Save hanksudo/859846 to your computer and use it in GitHub Desktop.
Load Image to UIImage from URL String
NSString *urlString = [NSString stringWithString:@"http://teddymaulana.files.wordpress.com/2009/11/iu1.jpg"];
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]]];
UIImageView *imgView = [[UIImageView alloc] initWithImage:image];
CGRect frame = CGRectMake(75, 75, 160, 230);
[imgView setFrame:frame];
[imgView setContentMode: UIViewContentModeScaleAspectFit];
[self.view addSubview:imgView];
[imgView release];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment