Pictures are very small when added to UIimageview in Interface Builder - iphone

I have 6 images, all the same size (65x65). When I create an imageview and add this image through the "image view attributes" in the interface builder, the picture is very small. Maybe 5x5. The pictures also show up small when viewing them in the resource folder however, when running the program, they are the right size. Is there some setting I need to change to get the images to show the full size/full resolution within the interface builder?
Thanks.

Make sure your UIImageView is active, then go to Layout -> Size to Fit (Command + '=' should also do the trick). This way the UIImageView will resize to fit the image and it'll look nice when looking at your stuff in IB.

Adjust the resolution of your image files to 72 dpi.

Related

Actual pixel dimensions of retina images (iOS)

After reading Apple's own HIG (specifically the 'Creating images for retina..' section) and looking at similar answers and suggested blogs - I can't seem to get a good solid fix on how properly design images for retina.
To best explain, let me set up a scenario:
I have a UIButton that is 44 x 44 points that I laid out in IB.
I go to photoshop, create an image that is 44 x 44 pixels. I save that as image#2x.png
I save another, without the #2x.png appended on the file name.
In the code, I do something like ... [UIImage imageNamed:#"image"]
From what I have read, it seems that DPI doesn't matter. I do also understand that retina images are, of course, double in scale to the original image. So for the scenario above, was the image#2x.png supposed to be 88 x 88 pixels instead of 44 x 44 pixels? In the [UIImage imageNamed:#"image"], do I need to specify the #2x in the image's name, or does xcode take care of that?
Going with the scenario I described above, can someone either correct me or confirm that this is the correct pixel dimensions the image?
The scenario you described is wrong.
Here are the right:
Assume you want a 44pt x 44pt button to place in IB;
Go to Photoshop create a 88px x 88px image named with #2x;
Create another image that 44px x 44px without addition #2x;
In your IB or code, set the image use normal name, which without #2x
in the image name. System will display the normal image and #2x
image properly.
To create button which IB size is 44x44 you need two images:
Image.png which size is 44x44
Image#2x.png which size is 88x88
iOS will automatically choose proper file when you use the base name
To load that image in code you simply use line below:
[UIImage imageNamed:#"Image"]
and again, iOS will get proper image

Iphone how to build UI for both resolutions 640X960 and 320X480?

since iPhone 4 now has 640X960 resolution i am confused how to build a proper UI for both 320 X 480 and 640 X 960 resolutions.. if i only use images and stuff of 640X960 resolution will it automatically adjust itself for smaller resolution iPhones.. if not what is the best way to differentiate on basis of device resolution??
You make 2 of each image - the first one at normal scale and named the usual "whatever.png". Then you make a second hi-res version of that image at double the scale and name it "whatever#2x.png". Then, iOS will handle the rest. You'll add both of those images to the project, and anywhere in the code that you reference "whatever.png", the system will take care of grabbing and using "whatever#2x.png" when and if appropriate, so you don't have to fuss with much. That's it. Simple.
In Interface Builder, just lay things out like normal using the standard sized graphics. In code as well, just reference images as usual, referring to the standard-sized images. So long as the higher-res counterpart is named with the "#2x.png" appended, everything will just work.
So, just as an example, say you currently have a project with a button image sized 40x100 named "awesomeButton.png". To support the retina resolution, create a new button image sized at 80x200, and name it awesomeButton#2x.png. Import it into your project and iOS takes care of the rest.

Image with gestures - phonegap

I'm making an application who needs to display a map, contained in a large image file (png). The user must be able to zoom in/out the image and drag it in order to scroll the image with touch gestures.
I'm not sure that you get it, but i want to display a single image as it would be displayed by the "Photos" iphone application.
I would like some hints about the best way to do it with those gesture and with a navigation header in order to leave the image view.
Thanks in advance if you can give me any help about this issue because I did not find any clue on the phonegap doc.
/ouss
Why don't you use the built inn components for this?
Sounds like you need to wrap an ImageView inside a ScrollView and a HorizontalScrollView, then rescale the image by handling onTouch-events.
Take a look at the MapKitPlug plugin:
https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/MapKitPlug
Good Luck!
I would use http://cubiq.org/iscroll-4 which has some really slick image zoom going on. You can also start loading new images after certain zoom levels for finer grains of quality.
I would suggest Child Browser phonegap plugIn.
It is very simple and easy to implement.
It supports loading page from a url as well as you can show any kind of images.(png, jpg, jpeg, bmp and gif)

Image overlapping in photo viewer on three20 framework?

I just integrated the photo viewer from three20 framework. Its working fine but some time images are overlapping, that ia happening only for thumnail image while original image is perfectly loaded. Till the original image loaded , at that point of time images are overlapping.
Did any one face this problem and have any solution for that?
Thanks
If images are overlapping, you are not correctly setting their size when you are including them in the photo view controller. You have to (unfortunately) tell three20 the exact size so it knows how to display them in paging mode of the scrollview.
Make sure you are resizing your thumbnails similar sizes to his (somewhere around 100 pixels tall or wide, based on if it's in portrait or landscape)
[[[MockPhoto alloc]
initWithURL:#"http://farm4.static.flickr.com/3444/3223645618_13fe36887a_o.jpg"
smallURL:#"http://farm4.static.flickr.com/3444/3223645618_f5e2fa7fea_t.jpg"
size:CGSizeMake(320, 480) // see how he sets the size here for each and every photo? this is crucial
caption:#"These are the wood tiles that we had installed after the accident."] autorelease],
If you look at the thumbnail, it is 67pixels by 100pixels: http://farm4.static.flickr.com/3444/3223645618_f5e2fa7fea_t.jpg
If you look at the regular photo, it is 320pixels by 480pixels. : http://farm4.static.flickr.com/3444/3223645618_13fe36887a_o.jpg
These are two independent files, the three20 code does not create the thumbnail for you based on the larger photo. You must do this manually or subclass whatever container class he uses to do it for you.
Just by setting line 135 of TTPhotoView.m to
self.contentMode = UIViewContentModeScaleAspectFit
will help.

iPhone 4 resolution difficulty - #2x naming technique not working for button image

I have a button with an image set through interface builder. The original image is SearchImage.png and the high rez version is SearchImage#2x.png. I'm absolutely sure that no typos were made, and the higher resolution image is indeed exactly twice the size (ie twice as tall, twice as wide) as the lower resolution image, yet the office's iPhone4 still only loads the low resolution image.
Does anyone have any ideas what the problem might be?
I have read all the relevant Apple documentation.
Thanks!
Tristan
Just assign the image property "SearchImage.png" and include both SearchImage.png and SearchImage#2x.png in your main bundle and it will load the correct image.
See https://devforums.apple.com/message/233916#233916.