To change the size of frame of the UIImageView as the image change can be done by getting the width and height of the UIImage. This can be done by declaring 2 float variables, storing the width and height of the image of the image in the respective variable and then use these variables in the frame of the UIImageView in which the UIImage is going to be placed.
NSArray *myArray = [NSArray arrayWithObjects:@"image1.png",@"image2.png",@"image3.png", nil];
float width;
float height;
UIImage *image = [UIImage imageNamed:[myImage.png]];
width = myImage.size.width;
height = myImage.size.height;
UIImageView *imageView = [UIImageView alloc]initWithFrame:CGRectMake(50,50,width,height)];
[imageView setImage :[UIImage imageNamed:[myImage.png]];
[self.view addSubview:imageView];
0 Comment(s)