uifont

iOS Foundation: system font size

我们两清 提交于 2019-12-04 18:13:13
问题 I would like to know if systemFontSize in iOS app tableView is always the same for textLabel? This is are depening to style? For example when I NSLog(@"%f",[UIFont systemFontSize]); I'm getting 14.0. Is this are always the same? And what's more: How can i change font size without changing the font-family (assuming that i have my own fonts in my plist). I tried: cell.textLabel.font = [UIFont fontWithName:@"Sansation-Light" size:12.0]; But UIFont always want for me fontname/family. How can i

iOS - Get the “real” height of a letter

非 Y 不嫁゛ 提交于 2019-12-04 17:18:57
问题 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 回答1: There are a lot of properties on UIFont to help in this

Change the default systemFont used by controls

我是研究僧i 提交于 2019-12-04 16:07:44
I have a big App and need to change the Font but I don't want to touch every Label, Textfield and so on. How can I access the "systemFont" used in IB and in [UIFont systemFontOfSize:x] ? I already tryed this one: iOS 5: Curious about UIAppearance but that's not the solution, cause I have different FontSizes and Bold/Regular all over my App and I can't set it overall. Can I set it via UIApplication or somewhere in InfoPlist? Paramasivan Samuttiram You can create Category for UILabel, UITextField and UIButton and can in the "awakeFromNib" method, you can just change the font name to new font and

Unable to set custom font for the UILabel in XCode

匆匆过客 提交于 2019-12-04 12:27:54
问题 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? 回答1:

Can I preload custom fonts on iPhone to improve performance?

可紊 提交于 2019-12-04 08:10:29
I've added the UIAppFonts entry on my info.plist to enable custom ttf fonts, it works fine. However when using the font there's also a delay in the UIView the first time it's called, is there a way to preload the fonts or some other technique to avoid this? Thanks In your application delegate or some other place that is called when the application launches try creating a hidden UILabel that uses your custom font and remove it straight away. That way it will preload the font so that the next time you use a UILabel with that font it won't pay the first time penalty. 来源: https://stackoverflow.com

make UILabel's text bold

陌路散爱 提交于 2019-12-04 07:46:48
问题 I want to make UILabel's text bold infoLabel=[[UILabel alloc]initWithFrame:CGRectMake(90,150, 200, 30)]; [infoLabel setText:@"Drag 14 more Flavors"]; [infoLabel setBackgroundColor:[UIColor clearColor]]; [infoLabel setFont:[UIFont fontWithName:@"Arial" size:16]]; [infoLabel setTextColor:[UIColor colorWithRed:193.0/255 green:27.0/255 blue:23.0/255 alpha:1 ]]; 回答1: Try [infoLabel setFont:[UIFont fontWithName:@"Arial-BoldMT" size:16]]; It may also be worth checking if the font you're trying to

UIFont fontWithName font name

旧时模样 提交于 2019-12-04 07:25:16
问题 Say you want a specific font for UIFont. How do you know what it's called? E.g. if you wanted to use this code: [someUILabelObject setFont:[UIFont fontWithName:@"American Typewriter" size:18]]; From where do you copy the exact phrase "American Typewriter". Is there a header file in Xcode? UPDATE Also found this handy. 回答1: Might be interesting for you as Quick Win within the Debugger: (lldb) po [UIFont fontNamesForFamilyName:@"Helvetica Neue"] (id) $1 = 0x079d8670 <__NSCFArray 0x79d8670>(

Is there a medium weight font between -systemFontOfSize: and -boldSystemFontOfSize:?

谁都会走 提交于 2019-12-03 22:03:59
-systemFontOfSize is too thin, and boldSystemFontOfSize too thick. I need something inbetween. When I create a UIFont like this: [UIFont boldSystemFontOfSize:14]; then the debugger prints this font info: font-family: ".Helvetica NeueUI"; font-weight: bold; font-style: normal; font-size: 14px Sometimes fonts have a medium font weight. How can I create a font of this type but with a medium weight? Calling NSLog(@"%@", [UIFont fontNamesForFamilyName:@"Helvetica Neue"]); prints all available font styles for Helvetica Neue, among them is HelveticaNeue-Medium which sounds like the one you want:

Writing Hindi language on UILabel in Xcode

主宰稳场 提交于 2019-12-03 21:54:28
I have written a code where I need to display hindi numbers on the UILabel. I used devanagari font to show that value but it doesn't work. It just changes the look but not the language. I was using: UIFont *font = [UIFont fontWithName:@"DevanagariSangamMN" size:16]; myLabel.font = font; But it's not working. Can anyone please help me with this? You have got the font name wrong. The font name is DevanagariSangamMN not DevanagarSangamMN (note the missing 'i' in your name). Your code should therefore be: UIFont *font = [UIFont fontWithName:@"DevanagariSangamMN" size:16]; myLabel.font = font; To

Determine if unicode character has a glyph in UIFont

二次信任 提交于 2019-12-03 20:32:16
I want to find out if a certain unicode character has a glyph representation even if by a cascading font. For example, let's say I am using UIFont.systemFont(withSize:18) and a string \u{1CDA} and would like to find out if this font will display the graphical representation of this character, and not a default question mark representation (ie there's no graphical representation, even by the supporting cascade fonts). This works for me. Swift 3, XCode 8.6 version: import UIKit import CoreText extension Font { public func hasGlyph(utf32 character:UInt32) -> Bool { var code_point: [UniChar] = [