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.
No comments:
Post a Comment