Display an image anywhere on the screen

Submitted by:Andery Smith

Date added:30 May, 2012


Display an image anywhere on the screen, without using UI Builder. You can use this for other types of views as well.

Tags: display image , image on screen

Code Snippet:

CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 109.0f); UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect]; [myImage setImage:[UIImage imageNamed:@"myImage.png"]]; myImage.opaque = YES; // explicitly opaque for performance [self.view addSubview:myImage]; [myImage release];