uifont

iOS: UIButton titleLabel — does it do anything at all?

元气小坏坏 提交于 2019-11-27 05:30:04
问题 I want to make a UIButton with type UIButtonTypeCustom (for the shape). I want to assign the title using button.titleLabel because I need to specify the font. The following code looks like it should work, but doesn't -- no label shows up, period. UIImage *editButtonImage = [UIImage imageNamed: @"editButton.png"]; float width = editButtonImage.size.width; float height = editButtonImage.size.height; UIButton *editButton = [UIButton buttonWithType: UIButtonTypeCustom]; editButton.frame =

iPhone - Convert CTFont to UIFont?

一笑奈何 提交于 2019-11-27 05:29:10
I am trying to convert a CTFont to a UIFont without losing any of the styles and attributes such as: Font Name Font Size Font color Underlines Bold Italic etc CTFontRef ctFont = ...; NSString *fontName = [(NSString *)CTFontCopyName(ctFont, kCTFontPostScriptNameKey) autorelease]; CGFloat fontSize = CTFontGetSize(ctFont); UIFont *font = [UIFont fontWithName:fontName size:fontSize]; Color and underline are not attributes of the font. Bold and italic are part of the font name. With ARC: UIFont *uiFont = [UIFont fontWithName:(__bridge NSString *)CTFontCopyPostScriptName(ctFont) size:CTFontGetSize

Custom Font in ios not working

♀尐吖头ヾ 提交于 2019-11-27 05:18:52
问题 I want to use HelveticaNeue-UltraLight in my ios application. I'm adding the font file as a resource to my project and adding the "Fonts provided by application" key in the plist file. The file name is HelveticaNeue.dfont and I've added it to the key array. When I check for the available fonts I can see it now... NSArray *fonts = [UIFont fontNamesForFamilyName:@"Helvetica Neue"]; for(NSString *string in fonts){ NSLog(@"%@", string); } 1-07-08 17:32:57.866 myApp[5159:207] HelveticaNeue-Bold

Change font of back navigation bar button

一曲冷凌霜 提交于 2019-11-26 19:21:44
问题 I want to be able to set the font of my apps navigation bar back button without doing anything too crazy and without losing any other design characteristics of the button (i.e. I want to keep the arrow). Right now I use this in viewDidAppear: to set the font of the normal bar button items. for (NSObject *view in self.navigationController.navigationBar.subviews) { if ([view isKindOfClass:[UIButton class]]) { [((UIButton*)view).titleLabel setFont:[UIFont fontWithName:@"Gill Sans" size:14.0]]; }

Change the font size of UISearchBar

感情迁移 提交于 2019-11-26 19:11:02
问题 How can I change the font size of UISearchBar ? Edit: Answer for(int i =0; i<[searchbar.subviews count]; i++) { if([[searchbar.subviews objectAtIndex:i] isKindOfClass:[UITextField class]]) [(UITextField*)[searchbar.subviews objectAtIndex:i] setFont:[UIFont fontWithName:@"Helvetica" size:12]]; } Thanks Pankaj 回答1: The UISearchBar has a UITextField inside, but there's no property to access it. So, there is no way for doing it in a standard way. But there is a non-stardard way to workaround it.

Custom UIFont baseline shifted

给你一囗甜甜゛ 提交于 2019-11-26 19:08:35
问题 I'm having a problem with custom UIFonts. I load 6 of them (font A in regular/bold/regularItalic/boldItalic, font B in condensed/condensedSlanted variants). However, here is what it gives when rendered: The two first rows are OK, but the last one exhibits a baseline problem. I've tried changing the UPM, ascender, descender, x-height of the font in FontLab so that it matches the first font's values (which render correctly), but to no avail. I've tried converting the font format from OTF to TTF

How to change an UILabel/UIFont's letter spacing?

感情迁移 提交于 2019-11-26 18:00:50
问题 I've searched loads already and couldn't find an answer. I have a normal UILabel, defined this way: UILabel *totalColors = [[[UILabel alloc] initWithFrame:CGRectMake(5, 7, 120, 69)] autorelease]; totalColors.text = [NSString stringWithFormat:@"%d", total]; totalColors.font = [UIFont fontWithName:@"Arial-BoldMT" size:60]; totalColors.textColor = [UIColor colorWithRed:221/255.0 green:221/255.0 blue:221/255.0 alpha:1.0]; totalColors.backgroundColor = [UIColor clearColor]; [self addSubview

How to convert CGFontRef to UIFont?

随声附和 提交于 2019-11-26 16:26:39
问题 I want to use a custom font for a UILabel . The custom font is loaded by from a file: NSString *fontPath = ... ; // a TTF file in iPhone Documents folder CGDataProviderRef fontDataProvider = CGDataProviderCreateWithFilename([fontPath UTF8String]); CGFontRef customFont = CGFontCreateWithDataProvider(fontDataProvider); CGDataProviderRelease(fontDataProvider); How can I convert the CGFontRef to a UIFont to be used in [UILabel setFont:] ? 回答1: Conrad's answer is close but doesn't quite work. You

UIFont - how to get system thin font

▼魔方 西西 提交于 2019-11-26 15:14:58
问题 UIFont has methods to get regular font ( systemFontOfSize ) or bold font ( boldSystemFontOfSize ), but how to get a "thin system font" available through storyboard? Passing "system-thin" to UIFont Contructor doesn't work, this constructor only works for non system fonts. 回答1: You can use system font thin weight: UIFont.systemFont(ofSize: 34, weight: UIFontWeightThin) List of available weights for San Francisco: UIFontWeightUltraLight UIFontWeightThin UIFontWeightLight UIFontWeightRegular

iPhone - Convert CTFont to UIFont?

爱⌒轻易说出口 提交于 2019-11-26 11:36:17
问题 I am trying to convert a CTFont to a UIFont without losing any of the styles and attributes such as: Font Name Font Size Font color Underlines Bold Italic etc 回答1: CTFontRef ctFont = ...; NSString *fontName = [(NSString *)CTFontCopyName(ctFont, kCTFontPostScriptNameKey) autorelease]; CGFloat fontSize = CTFontGetSize(ctFont); UIFont *font = [UIFont fontWithName:fontName size:fontSize]; Color and underline are not attributes of the font. Bold and italic are part of the font name. 回答2: With ARC: