Skip to content

Instantly share code, notes, and snippets.

@oliverbarreto
Created May 4, 2013 19:27
Show Gist options
  • Save oliverbarreto/5518465 to your computer and use it in GitHub Desktop.
Save oliverbarreto/5518465 to your computer and use it in GitHub Desktop.
Objective-C: Create UIImageView
//First Create a Image & FrameRECT
UIImage *someImage = [UIImage imageNamed:@"a.png"];
someRECT = CGRectMake(0, 0, weight, height);
//Method A
UIImageView *imageView = [[UIImageView alloc] initWithFrame:someRECT;
[self.view addSubview:imageView];
//Method B
UIImageView *imageView = [[UIImageView alloc] initWithImage:someImage];
imageView.frame = CGRectMake(0, 0, width, height); //If want resize of the original size of the image, set the size of your UIImageView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment