Created
March 8, 2011 04:29
-
-
Save hanksudo/859846 to your computer and use it in GitHub Desktop.
Load Image to UIImage from URL String
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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