Question: OBJECTIVE - C !!!!!!! OBJECTIVE-C PROGRAMMING LANGUAGE! I added a uiview as a subview programmatically (called contentView). I also added an image on that uiview.

OBJECTIVE - C !!!!!!!

OBJECTIVE-C PROGRAMMING LANGUAGE!

I added a uiview as a subview programmatically (called contentView). I also added an image on that uiview. Every time I run the app on the iPad the image is stretched! How do I fix the image so that it fits the iPad screen but doesn't stretch the image? PROGRAMMATICALLY !!!

Here is my code:

UIGraphicsBeginImageContextWithOptions(self.contentView.bounds.size, self.contentView.opaque, 0.0);

[[UIImage imageNamed:@"menu image 2.JPG"] drawInRect:self.contentView.bounds];

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

[self.contentView addSubview:imageView];

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!