uifont

how to add new font to Xcode 3.2?

為{幸葍}努か 提交于 2019-12-03 19:38:19
please tell me how to add new font to iphone xcode3.2. This functionality isn't built into UILabel/UIFont in iOS < 3.2. But there is a third-party solution you can use: FontLabel In iOS 3.2+, there's the UIAppFonts plist key ! Just do this before using it: add your font file (such as myfont.ttf ) to your project, then edit the Info.plist like so: info.plist http://cl.ly/97da7a4f67b1b81a540f/content The above methods worked for me in xcode 3.2! Thanks!: step 1: drag your font into your project (prob a good idea to not have spaces in the font name) step 2: add a row to your info.plist file like

How to detect Dynamic Font size changes from iOS Settings?

穿精又带淫゛_ 提交于 2019-12-03 14:30:03
问题 Inside settings->general->text size, after changing the text size, I'd have to exit my own app to have the sizes applied to [UIFont preferredFontForTextStyle:..] Is there a delegate or notification to notify my app to re-apply the new sizes? Update: I tried the following but interestingly, the font size will apply after I BG and launch the app TWICE. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [[NSNotificationCenter

-fontWithSize returning different font object

老子叫甜甜 提交于 2019-12-03 14:11:51
Update 1 I found a work-around: // instead of font = [font fontWithSize:pointSize]; // i can do this and get the correct font back font = [UIFont fontWithName:font.fontName size:pointSize] I'm using Nick Lockwood's HTMLLabel class to turn HTML into an NSAttributedString that respects the styling within the HTML. For the most part, it works great. However, I'm using a custom font in my app, and for some reason, my font is always getting rendered in bold. I don't have this problem using the system fonts. I've narrowed it down to this method: - (UIFont *)font { // ** Code Path 1 ** UIFont *font =

iOS Custom Font displaced

♀尐吖头ヾ 提交于 2019-12-03 14:04:22
问题 For a project I bought a OTF font and included it into my project (with adding to plist file etc). It works and I can set the font on my buttons, but the label is displaced then. I added a screenshot so you can see my issue. Anyone an idea what the problem can be? system: iPad 3 with iOS 6.0 beta, but same problem on iOS 5.1.1 EDIT: I found a post about the problem. http://www.andyyardley.com/2012/04/24/custom-ios-fonts-and-how-to-fix-the-vertical-position-problem/ 回答1: Ok, now I got it :)

Different font size in the same label?

霸气de小男生 提交于 2019-12-03 13:40:55
Is it possible to have different fontsize or weight in the same UILabel? I can do it in the storyboard as Attributed label, but I need to do it programmatically. cell.lblOne.text = [NSString stringWithFormat: @"FontSize15:: %@, FontSize20:: %@",monkey, goat]; Edit: I saw something about NSAttributedString but I can't get it to work. foundry Take a look at my answer here: UITextView Alternative make an NSMutableAttributedString give it some attributes (applied to ranges of characters) set the label's attributedText property . NSMutableAttributedString *attString = [[NSMutableAttributedString

Replace the deprecation sizeWithFont:minFontSIze:actualFontSize in ios 7

泄露秘密 提交于 2019-12-03 13:25:14
问题 In iOS 6 i was using this method: [self.handText sizeWithFont:font minFontSize:10.0f actualFontSize:&maxFontSize forWidth:handWidth/2 lineBreakMode:UILineBreakModeClip]; xcode 5 says that 'sizeWithFont:minFontSIze:actualFontSize:forWidth:lineBreakMode:' is deprecated:first deprecated in iOS 7 Now i implemented like this: [self.handText sizeWithAttributes:@{NSFontAttributeName:font} minFontSize:10.0f actualFontSize:&maxFontSize forWidth:handWidth/2 lineBreakMode:NSLineBreakByClipping]; here

iOS - Get the “real” height of a letter

与世无争的帅哥 提交于 2019-12-03 11:05:10
I am trying to layout text on a UIView. (The yellow area is the frame of the UILabel with a background color). When I use sizeWithFont I get this, which has a very large space above the letter: When I use font.pointSize i get this for "i" which is good- BUT When i use it for "p" I get the precise height but the letter is drawn in the bottom and cropped. **How can i get get the glyph only centered in the frame ? ** Thanks Shani There are a lot of properties on UIFont to help in this situation: pointSize ascender descender capHeight xHeight lineHeight basvk You could convert the UILabel to a

How to create bold UIFont

我是研究僧i 提交于 2019-12-03 10:35:04
问题 I am doing some word wrapping in my tableview as some of the values are so big they go off the edge of the screen. However, the font and size and boldness dose not match the default settings of the table view and was hoping someone could help me fix that up. This is what I am doing to set the fields: - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *cellText = @"Go get some text for your cell."; UIFont *cellFont = [UIFont fontWithName:@

UITextView font is nil

﹥>﹥吖頭↗ 提交于 2019-12-03 09:22:43
I created a UITextView with a font size of 14 in a storyboard and hooked it up to the detailDescriptionLabel property of my ViewController. This code is in viewDidLoad: self.detailDescriptionLabel.font=[UIFont systemFontOfSize:10]; NSLog(@"text is %@; font is %@", self.detailDescriptionLabel.text, self.detailDescriptionLabel.font); The console output follows: text is Lorem Ipsum; font is (null) Why is the font set to nil? The setFont: is working; the font does shrink. I want to get the font so after a gesture I can call lineHeight on the font. This way, I can find out which line has been

Unable to set custom font for the UILabel in XCode

℡╲_俬逩灬. 提交于 2019-12-03 08:05:36
I am unable to set custom font for the UILabel in XCode. This is what I've tried: Download "JennaSue" font -- http://www.dafont.com/jenna-sue.font Open "app-info.plist" under "Supporting Files" folder Add new row in the list with key "Fonts provided by application" In this array add "JennaSue.ttf" Use it in the code like this: self.someLabel.font = [UIFont fontWithName:@"JennaSue" size:14]; And nothing happens -- the default font is visible. Why? What am I doing wrong? How can I fix it? Be sure your font is in Bundle Resources. For some reason Xcode it is not importing custom font properly