UITabBarItem and icon size - objective-c

I am using UITabBarItem. If i set image, its not correctly displayed. Image is "zoomed", so I can see only top part of it. Image size is 60x60px.
I am setting image from xcodes XIB editor -> BarItem -> Image
Whats wrong with it ? According to Apple Doc, image should be 60x60 for Retina and even bigger images should be auto-scaled to fit viewing area.

When you are supplying a retina image you should name it with [name]#2x~iphone.png or [name]#2x~ipad.png. Then, in the IB you should put the name of the file without the whole suffix, so just [name] instead of [name]#2x~iphone.png. The image won't show up in the IB, but should be ok in the live app.

First, you have to make two icons, one of 30x30, and a second one 60x60 with "#2x" appended at the end of your filename.
Then bind the 30x30 icon to your UITabBarItem in XIB editor. Apple should select automatically the appropriate picture to display depending on the device it's running on.

Related

How to resize/change the layout of a foreground image

I need an image to display and run a .gif, and therefore it must run in the foreground, but the image I am using from a resources folder is not the same size it will need to be when actually in the program. I can change the BackgroundImageLayout property, but that doesn't do anything to the image as it is Image and not BackgroundImage
Put simply, is there any way I can resize a foreground image without having to create a new copy of the image that's the right size?

xcode6 storyboard uibutton image title laybout

how can i set button's image and title correctly position.
now the storyboard preview like:
I add title and image to the button and set title and image edgeinset to get picture layout. but the button'size is changed with the phone size. so i can't set it in storyboard properly for all size.
i want to to know is there a way to deal with this situation?
thanks!
see the tutorial link below ,
http://www.appcoda.com/introduction-auto-layout/
it's show how to fix constant heigh and width of view.
you see clear in image how it done.

I want to make some area of image transparent. Image is set as background of an UIButton

I have an image with irregular shape. I set it as a background image of an UIButton.
Now, I use OBShapedButton library to enable touch only where image is non-transparent. But, for some reason if I click on transparent image area, when view appears in screen, then it responds to click, whereas it should not.
I made some area of image transparent using adobe cs4 photoshop. Now, I want to try making it transparent in xcode only. May be it helps.
To have an idea of image shape I am attaching a sample image.
Does anyone know how to do that?

Load larger image on tap of small image with animation

I'm trying to load a large version of an image in the centre of the user's screen when then tap on a smaller version of the image that's already on my view.
Ideally I want to do this using an animation to get to the new image like a vertical flip.
Also if there's a way to make the background look greyed out like it's not the foreground then that would be even better.
Here's an image of what I'm after, I'm at work at the moment so haven't got access to the actual code / images.
I'm a new user so can't add pictures. Click here if you want to see what I'm thinking.
Image
There is an KGmodal Example Exist in GitHUB hope that Might Help you.
You have to Change the content view and Add an Imageview Programatically (with required size ) in the content View.
Follow the below link: https://github.com/kgn/KGModal
For Fliping the image see the tutorial iphone Flip Image.
In the end I added the larger image on to begin with and set its alpha to 0, then added a gesture recognizer on the smaller image that animated the larger one and gradually changed its alpha to 1. The did the reverse on the large image. Don't know why I didn't think of that in the first place!

Segmented control segment images

In my project I am using segmented control with 3 segments. I have picture for every segment and pressed/unpressed state. Here is image:
Image link
If picture size is not matching segment size then it not fits. Is there any solution for this problem?
Thanks
If you're using iOS 5 or later, you can use UIImage's resizableImageWithCapInsets: method to create resizable buttons for your segmented control and then just render your text on top of it. A good tutorial on this is available here.
Essentially, all you have to do is create versions of your button images that have distinct ends and centers that can be resized.
Use - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets method of UIImage for setting image to your button. It will return you resized image for your button. Available in iOS 5.0 and later.