Importing a Sketch Image into Xcode (Using UIBarButtonItem) [duplicate] - ios

This question already has an answer here:
UIBarButtonItem showing up as a blue square instead of the image I want (Interface Editor)
(1 answer)
Closed 6 years ago.
I am trying to put a Sketch image into a UIBarBuuttonItem. The image has a transparent background and the image is a camera that is blue with a white circle inside. I am sure I'm exporting the entire image. I am using a 1x, 2x, and 3x version of the image and when I set the image of a UIBarButtonItem in the storyboard, it only shows the blue part of the camera and not the white circle inside. If I put a UIImage in a ViewController and set it to the same image, the image shows up correctly. The image shows the difference. Thanks in advance]1

In your image in xcasset, try change it's render to Original image in attribute inspector, maybe the issue is the tint color

Related

Problem to set a custom image to TabBarItem [duplicate]

This question already has answers here:
How can I remove the blue square that overlays UITabBarItem when selected?
(3 answers)
Closed 4 years ago.
I've a image 30x30 and I want set like TabBarItem in my TabBar. But when I set the result is this:
The large blue square appears instead my image.
Did you check your image file name? Becuase I had exactly same experience and it was imge file name did not match with the name I put on storyboard
Make sure your image is single-color, preferably black and white. If there's a background, even one with a low alpha, you may get this effect. The OS is trying to make an iOS-style tab bar image (think of the ones in the Music app), which is single color. It converts the non-transparent pixels to blue, and the transparent ones to white/clear. If the entire image is non-transparent, you'll end up with that.

Toolbar button image suppressed

I have a viewcontroller with a toolbar with 2 bar button items. The image on one is a simple flat icon. The other is a complex image reduced to 28x28 pixels from a 256x256 image. The complex image shows up as a blob as shown below. The actual image is also show in the picture. It is not clear what I am doing wrong. The project code is available in the following link:
Project code
John Griffith on Apple Developer Forum provided this explanation which made a lot of sense. I need to redesign my icons if I want to proceed along this line:
Toolbar images are normally rendering mode "template" - only the alpha channel is used. Any non-transparent pixels are drawn in the bar's tint color. It may be possible to create a UIImage with rendering mode "always original" to preserve the look of your image, but then it won't respond to changes in tint color.
I have downloaded your project. The first thing you should do is to move your image files into the images.xcassets folder. Read here to understand why.
The image you are trying to display is actually just a red rectangle:
As you can see, opening in another program also just displays it as a red rectangle. Be sure to use the correct Image file. The problem lies not with your project but rather the image file you are using.

iOS 8 bar button item image color [duplicate]

I am adding my own image icon in the bottom of the tab bar, but it only shows a grey square and the title.
How can I fix this?
The problem is that your image lacks transparency. The tab bar expects your image to be a transparency mask (also called a template) - only its degree of transparency / opacity is taken into account. Your image is completely solid opaque, so it appears as a solid square.
Either fix your image, or derive from it an image whose rendering mode is Always Original to force that actual drawing of the image to appear instead of its opacity.

Add Image on another Image in iOS considering alpha parts [duplicate]

This question already has answers here:
Overlay an image over another image in iOS
(4 answers)
Closed 9 years ago.
I have tried, compositing filters, both ATop and Over, But did not get the required Image as out put.
what I want is something like this:
NOTE: both the Image1 and Border are png Images.
Now what i am getting is either the border1 image or the image1 image, it seems they are not considering the alpha parts in border1 image, its removing the alpha channel and am left with a white background under the border image instead of image 1 peeking out.
Any idea about how to proceed? thanks in advance.
Use the UIImage converted to CIImage with data as png, with this following code
CIImage *paper1 =[CIImage imageWithData:UIImagePNGRepresentation([UIImage imageNamed:#"yourPNGImage.png"])];
This Solves the problem, since earlier times the UIImage (though in .png format) was getting converted into a jpeg format CIImage.

Using images in UIView as background, retina screen

i want to set an image to a custom UIView. I created the Image in Photoshop with 100 by 100 pixels.
Then I did:
self.customView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"Image.png"]];
And it worked just fine, except that i could see the pixels on my Retina display. Don't get me wrong i saw that coming, because i set the image in Photoshop to 100x100 and the UIView to 100x100. So due to the "false" pixel definition in xcode it is displayed with the double size pixels.
But how can i create a image, say an image with 200x200 and then set it to the background of the 100x100 View so it is displayed with native resolution. I tried to search for something like "scale to fit"-function for the backgroundPattern for the UIView but couldn't find anything.
So my question is, how do i set an image as "Retina 2x" Image?
And how do i get it into my UIView?
Thanks in advance!
This is your answer.
Basically put two images in your project. "Image.png" and "Image#2x.png". The code inside [UIImage imageNamed:#"Image.png"] will pull from the correct image based on the screen hardware.

Resources