I am trying to create a box that pops up in my xcode app that just displays an image of that size. I have the following
UIImageView *newView=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"beach.jpg"]];
but this creates the full size image and just shows it. How would I only show it as 100w by 100h at 50 over and 200 down? Would I use CGRect?
Also, can I make it so that clicking it causes it to disappear?
edit #1 I don't want to resize down the image - would rather just pull the 100 squared pixels and place them in a frame.
Please try using the following code.
MyImageview.contentMode = UIViewContentModeScaleAspectFill; MyImageview.clipsToBounds = YES;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With