0

I have an image which is 200x200 but I want to display it in full screen in iphone 5 .So when I display that image in full iamge view it is stretched . What to do??/

prajapatijayesh
  • 339
  • 5
  • 13

2 Answers2

1

It's not possible. A single 200x200 image cannot fill a space larger than 200x200 without stretching/scaling.

You do have various options for displaying it in an UIImageView though See Apple's Documentation on UIViewContentMode for the contentMode options.

UIImage *img = [UIImage imageNamed:@"glyph"];
self.imageView.image = img;
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
DBD
  • 23,075
  • 12
  • 60
  • 84
  • then tell me how to show image in landscape if its width is more than height or in portrait respectively. Means if image is in portrait mode it should be display in portrait if in landscape then in it – prajapatijayesh Feb 25 '14 at 17:07
  • i dont want it in aspect fit..because if image is as shown as it fits in our screen but i want it ti display in full height in iphone – prajapatijayesh Feb 25 '14 at 17:34
  • I have seen/done this two ways. The first way is to have two images and switch between them when the device rotates between portrait and landscape. The other way is to have an image that's bigger than the screen, realizing some of the image will be cropped out in each orientation (I've only had this technique useful a couple times). – DBD Feb 25 '14 at 20:20
  • yes you'r right...this thing help us many times but in my this app i particular need to show image in full screen whatever image size..I also think thats not possible because if image is of 200x200 and you resize it in 320x524 it will be stretched. Do you know any library like imagepicker editing mode allow through which user can crop image in whatever size they want by adjusting cropview??? – prajapatijayesh Feb 27 '14 at 08:23
  • Sorry, that I don't know. I have not had the opportunity to write any code which involved users manipulating images. – DBD Feb 27 '14 at 18:16
0

You need to resize the image with size of full screen size and then display on full screen. For reference, please check the following answer:

How to resize the image programmatically in objective-c in iphone

Hope, It will help you, Sir

:)

Community
  • 1
  • 1
Gaurav
  • 299
  • 4
  • 15