Home Tutorial Iphone Examples UIIMageView Add Image

 
 

UIIMageView Add Image
Posted on: September 22, 2010 at 12:00 AM
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.

Related Tags for UIIMageView Add Image:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.