How to create custom vector icons to use in Xcode application - xcode

I'm currently trying to figure out how I can make those glyph/vector icons appear like the default ones that you get with Xcode (e.g. NSActionTemplate). I researched and saw that they were saved in Illustrator to PDFs.
When I did the same trick (I managed to find the original Illustrator files for the icons by Apple) and saved it as an PDF, imported it into my project and dragged the icon onto a textured button it appeared plain black. It did however clear the white background so I thought it might be the white background that was visible in the preview that caused it to not style the button like the originals.
So basically what I'm asking is how I manage to make a icon appear like the default. I don't really wan't to make multiple files and/or code the behavior, since it should be quite easy to just drag and drop the image onto a button and apply the style itself.
-- EDIT --
OK, so I found the solution — By appending the text "Template" to the filename it will do this. But I still can't figure out why my transparent PDF - exported from Illustrator as AI and EPS - it still have a white background, which Xcode uses - so it will be a rectangular with the effect I want, instead of the circle.
Anyone that have an idea on how to remove the white background from the PDF so it will work in Xcode. It bugs me that it shows it is transparent (when seeing transparent grid in the PDF and Illustrator) and it still have a white background.

The white background in the PDF (and you should always use PDF over EPS—they "play nice" with OS X) has to do with the PDF format originally being oriented toward printed content. The white background you see in Preview and Xcode is the "page" area. Fortunately, this usually goes away / gets ignored when you load the PDF into an NSImage, as happens when you put it on a button.
If I'm understanding correctly, the problem you're having is you place a PDF with no background on a button, and in Xcode's Interface Builder it displays as if there were a background? I was able to reproduce this behavior, and I'm not sure what caused it. But I built and ran a test app with the very same Template file and errantly-displayed NIB. And in the actual, running Cocoa app, the graphic displayed correctly.
Sometimes Interface Builder just previews wrongly. I suspect the problem is merely cosmetic in preparing the interface.

Related

Why do standard applications show slightliy different colors

I uploaded a simple png file with a overall fill color here: https://ufile.io/kx1mopq2
If i view this file in the windows explorer or in firefox the color displayed is slightly different than the color shown in Windows Paint, Paint 3d or several other applications i tested - including WinApi and Qt applications i developed myself.
In the screenshot below on the left you see firefox and windows explorer preview - we think that this display color is the correct one. On the right you see Pant and paint 3d. I modified the file in paint as i moved a strip from the left views into the right views in order to make the difference visible.
My question is: Where do these differences have their origin? I want my applications to show the same color as FireFox or Windows Explorer. It seems that there is a application setting or the like that influences that?
Any suggestion welcome.

Hex color code copied from online appears different while using as main storyboard background in swift?

I have tried to use this color from web as my storyboard background
Hex color code copied from online appears different while using as main storyboard background in swift?
00ABCA
when I paste it in xcode, It displays a various shade in same color, and not the one I have seen online. Why there is a difference?
How do I use the color what I see online by using its Hexcode ??
You probably haven't selected the right color profile. To change the color profile, click the settings icon on the color picker screen (where you entered the hex-value):
Now you should get a menu like this:
In order to get the exact same color, make sure that the color profile from the website and XCode match. If the website doesn't explicitly says which one they use, I would try 'generic RGB' (or just try them out until you get what you want).

Why does macOS Finder draw areas of my app icon where alpha != 1 in black?

When I select my app in Finder using the columns display, the app icon displayed in the rightmost pane has all areas where alpha != 1 rendered in black.
Screenshot showing alpha!=1 areas in black
However you can see the the icon in the middle pane is rendered correctly. Also if I view the app's .icns file in Finder it is rendered correctly:
screen shot of app's .icns file
The icon is also rendered correctly in the Dock and in Launchpad.
Why does Finder render black in this one case?
macOS Sierra 10.12.5 but I doubt the issue is specific to this version.
I have spent almost a day hunting for solutions on the net but have not found anything even remotely close to this problem. No other app exhibits this issue. I have also tried to find an application that will let me view the details of each image of a working application's .icns file. Again without success.
Make a new .icns file using Image2Icon instead of Axialis IconWorkshop.
Following I'L'I's suggestion I examined the icon file with Preview. Preview shows that the 512x512 & 72x72 sizes do not have an alpha channel and have a black background where alpha != 1 in the 1024x1024 and other images that do have alpha. There are other strange images, including gray scale.
The .icns file was created for me by the icon designer using Axialis IconWorkshop. I do not have this software so do not know if the strangeness is cockpit error or application bugs.
I made a new .icns file from the same input PNG file using Image2Icon. In this file, all sizes have alpha and there are no strange images. Using this file, the display in Finder is correct.

Xamarin - how to center a launch screen image (iOS)?

I'm using Xamarin for Visual Studio, and am getting frustrated trying to do what I would think should be a very simple thing: creating a launch (splash) screen for iOS, that has a single image that is centered on the screen (vertically and horizontally centered).
I'm creating it the recommended way, using a storyboard (other methods, like using an assets catalog, are considered deprecated as of iOS 9). In the storyboard, I have a View Controller, which contains a View, which contains an Image View. In the Properties pane, I've tried messing with the Mode (in Widget tab), and I've tried playing around with contstraints - which I think might be the key, but it is difficult to understand how it all works together.
You need to add the Splash screen in the applications properties (Launch Images). You need to create the image and upload it via that section. I couldn't find anything saying that the use of Asset catalogues are depreciated.

#2x images do not display in XCode4 interface builder designer

I'm trying to design a xib using XCode4, but when I put down an image view that displays an #2x image xcode doesn't preview it correctly (it displays a missing image icon).
It works correctly when the app is run though.
As an example: I add a UIImageView to my view and set the image property to test.png.
In my project I add a file named test#2x.png.
In XCode 3.2 this image would have correctly displayed in IB, and the #2x version would have automatically half-sized on non-retina devices.
However in IB in XCode4 the image does not display.
Is anyone else experiencing this? If they are, it's a pretty massive issue.
Why not just add both images? AFAIK UIImage isn’t guaranteed to work like that.
I always use both sizes, having the #2x ones first, and unretining them using the free app unretiner from app store, and drop both sizes to the project. When referring to an image, instead of writing test.png or test#2x.png, I write test and xCode finds sizes to the corresponding devices, but YES! in IB, the image won't be displayed in this way, just a question marked blue screen; but that works fine when running the app.

Resources