Share on Google+Share on Google+

UIIMageView Add Image

Advertisement
initWithImage is a image declaring method that is used to declare the image while while creating a UIImageView.

UIIMageView Add Image

"initWithImage" is a image declaring method that is used to declare the image while while creating a UIImageView.

Syntax of initWithImage method
- (id)initWithImage:(UIImage *)image;

a simple example

//declare the Image
UIImage *one = [UIImage imageNamed:@"myImage.png"];
//creating a UIImageView
UIImageView *imageView1 = [[[UIImageView alloc] initWithImage:one] autorelease];

//to add image on view
[self.view addSubview:imageView1];

You can write and run the above given lines of code into the "ViewDidLoad" method.

Advertisements

Posted on: September 22, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.