Custom font in interface builder [duplicate] - iphone

This question already has answers here:
Using custom fonts in interface builder
(6 answers)
Closed 9 years ago.
I want to install custom font and used in UIlabel from ibterface builder,xcode4.2?I tried the Google ways but its not showing in the Interface builder?

Add the font file in your project and use the following to set the font.
self.font = [UIFont fontWithName:#"yourFontName" size:yourFontSize];

First save your custom font file in your project folder and then you have to add it to Your_Project_name-Info.plist file which might be located in your supporting files folder
click on Your_Project_name-Info.plist
Add new object(array)=>type Fonts provided by application on key field.
Add an object in that array with name of your font

As of now, Xcode 4.6, you cannot have Interface Builder display a custom font that it did not already come with. In order to have a label use a custom font you will have to display it programmatically. Which means that you will be unable to use IB to determine how long to make a label or anything like that.

Related

custom fonts is not work in my iOS app [duplicate]

This question already has answers here:
Custom font is not working in my App?
(8 answers)
Closed 9 years ago.
Hai i have using already custom font ,But now i try to add font file it wont work properly ,i will try to use angry bird font file to add my application its not working.Remaining font file also not supporting i don't know i am doing correctly r not.My reference links http://refactr.com/blog/2012/09/ios-tips-custom-fonts/
https://wiki.appcelerator.org/display/guides/Custom+Fonts#CustomFonts-Sampleapp
Custom Fonts are easy as pie in iOS. If you use the Approach from http://refactr.com/blog/2012/09/ios-tips-custom-fonts/ like in your question you are read to go. But there is a really great difference in the font family name that you get from the font explorer from OSX and the actual family name in iOS.
You can get the family name via [UIFont familyNames] in your code. Now you have a Family name. Log this to your console via NSLog and then simply use [UIFont fontNamesForFamilyName:#"the_family_name_of_the_font"].
More information for familyNames and fontNamesForFamilyName:
Here are the steps transcribed:
1) Add your custom font files into your project using Xcode as a resource
2) Add a key to your Info.plist file called Fonts provided by application.
3) Make this key an array
4) For each font you have, enter the full name of your font file (including the extension) as items to the Fonts provided by application array
5) Save Info.plist
Now in your application you can simply call
[myLabel setFont:[UIFont fontWithName:#"Swis721 Lt BT" size:[lbl minimumFontSize]]]; //use font name not file name.

How can we use custom font in an iOS app? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Can I embed a custom font in an iPhone application?
How can I customize font in my iPhone app?
Is it possible?
How can I use this custom font in a UILabel?
I am trying to add MYRIADPRO-SEMIBOLD.OTF font in my App.
and the code is
UIFont *customFont = [UIFont fontWithName:#"MYRIADPRO-SEMIBOLD" size:35];
titleLbl.font = customFont;
And the Plist is
Try the steps below:
1. Make configuration in the info.plist as shown in Image
2. Now you should use that added file
UIFont *customFont = [UIFont fontWithName:#"fontName" size:size];
// further you may set That Font to any Label etc.
EDIT: Make Sure you have added that file in your resources Bundle.
Copy your font file into Resources.
In your application .plist create (if it exists just create a row) a row called Fonts provided by application and then in item 0 copy your font name for example Ciutadella-Bold.otf
Then you can define this font in your application:
UIFont *CiutadellaBold = [UIFont fontWithName:#"Ciutadella-Bold" size:17.0f];
And use it in for instance in UILabel:
[uiLabel setFont:CiutadellaBold];
It is totally possible. Please check the following links to implement your solution.
iPhone Development: how to use custom fonts?
How to add custom fonts to an iPhone app?
how to use custom font in iphone application
Can I embed a custom font in an iPhone application?
I hope these links help.

Custom font doesn't work in interface builder!

I've downloaded a font that's called "aldo the apache (.tff) " from dafont.com.
I used it with different programms like adobe illustrator and it seemed to work just fine.
Recently i tried to use it in a game that i'm making to experement. It didn't work -_-.
IB was displaying the font as a slightly bigger version of arial.
How can i solve this problem and get the font to display correctly?
If you have any suggestions, please post them down below.
-DD
You have to edit your <appname>-Info.plist file and create a new UIAppFonts key with type array, where each element is a String with the name of your font file, in this case AldotheApache.ttf. Then use the name in IB or with UIFont as it shows in the application Font Book app of your Mac, in your case Aldo the Apache. Obviously the font should also be added as a resource of your project.

ttf font not available for iPhone in interface builder or simulator

I added a font file (.ttf) to my Xcode project, to resources. Also, I added it to the UIAppFonts in my info.plist.
When I want to use this font though, I don't even see it as a choice in IB.
After installing the font on my system, I started seeing it in IB, but still - changing to it doesn't change anything - some default system font is displayed in the Interface Builder as well as in iPhone emulator.
Are there any steps more I should do to be able to use my own font?
To use custom fonts with iOS you have to set them programmatically.
For example, suppose you have a font file called swellfont.ttf that you add to your project.
You then would go into your App-Info.plist file and add the full name of the file to the next index of the array keyed by UIAppFonts, as you mention.
<key>UIAppFonts</key>
<array>
<string>swellfont.ttf</string>
</array>
Then, to use the font:
label.font = [UIFont fontWithName:#"swellfont" size:12];
Assuming that label is a UILabel and that swellfont.ttf is not protected. It's important to note that UIFont's fontWithName is not referring to the filename, instead its wanting the actual name of the font. If you open the font with FontForge you can see this information by selecting Element > Font Info from the menu bar. There are probably cleverer ways to find this information out.
I use 2 fonts in an APP. The first one was automatically added to the "Copy Bundle Resources", the other was not. I had to add that one myself.
Call in code:
[labelName setFont:[UIFont fontWithName:#"OneGreatBigFont" size:40]];

Accessing Images from Xcode "Folder Reference" in Interface Builder UIImageView [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
iPhone Interface Builder - Moved resources to sub-directory, now IB can't see them!
There is a Folder Reference that contains my images in Xcode. I want to load an image from that image into an UIImageView inside of Xcode rather than programmatically, so I can visually design the interface.
Not only do the images in that folder not appear in the Image View->Image drop-down menu in Interface Builder, the images don't show up when I manually type in the path.
Try putting the images into the Resources folder in Xcode instead of your folder reference. Also, make sure the images have been added to the target from which you want to be able to access the images. To do this:
Select the image in the Groups & Files column in Xcode
Right-click on the image and select Get Info
In the Info window that comes up, select the Targets tab
Check the boxes next to the targets that you need to be able to access this file from