Tag: uifont

如何更改UILabel / UIFont的字母间距?

我已经search到负载,找不到答案。 我有一个正常的UILabel,这样定义: 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:totalColors]; 而且我希望字母之间的水平间距更紧,同时保持字体的大小。 有没有办法做到这一点? 这应该是一个非常基本的事情。 干杯,安德烈 更新: 所以我被迫这样做: – (void) drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSelectFont (context, "Arial-BoldMT", 60, kCGEncodingMacRoman); CGContextSetCharacterSpacing […]

自定义字体在ios不工作

我想在我的ios应用程序中使用HelveticaNeue-UltraLight。 我将字体文件作为资源添加到我的项目中,并在plist文件中添加“由应用程序提供的字体”键。 文件名是HelveticaNeue.dfont,我已经将它添加到了关键数组中。 当我检查可用的字体,我现在可以看到它… 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 2011-07-08 17:32:57.866 myApp[5159:207] HelveticaNeue-CondensedBlack 2011-07-08 17:32:57.867 myApp[5159:207] HelveticaNeue-Medium 2011-07-08 17:32:57.867 myApp[5159:207] HelveticaNeue 2011-07-08 17:32:57.868 myApp[5159:207] HelveticaNeue-Light 2011-07-08 17:32:57.868 myApp[5159:207] HelveticaNeue-CondensedBold 2011-07-08 17:32:57.868 myApp[5159:207] HelveticaNeue-LightItalic 2011-07-08 17:32:57.869 myApp[5159:207] HelveticaNeue-UltraLightItalic 2011-07-08 17:32:57.869 myApp[5159:207] HelveticaNeue-UltraLight // HERE […]

你如何改变UIFont的颜色?

我search了网页,但是我不能得到一个好的答案,虽然我确信这很简单。 有人可以告诉我如何做到以下几点:制作名为“Helvetica-Bold”,大小为8.0,颜色为黑色的UIFont。 我有名字和大小,但我不知道如何改变颜色: UIFont *textFont = [UIFont fontWithName:@"Helvetica-Bold" size:8.0]; 谢谢!

你如何在Swift中风格化字体?

我正在尝试开发Swift,它进展得非常好。 我遇到的其中一个问题是如何在程序语言中编程字体。 例如,在这个标签中,我写了下面的代码,例如,我怎样才能使它成为Helvetica Neue Ultralight? label.font = UIFont (name: "Helvetica Neue", size: 30)

使UILabel的文字变粗

我想让UILabel的文字变粗 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 ]];

更改后退导航栏button的字体

我希望能够设置我的应用程序导航栏后退button的字体,而不做任何太疯狂,不失去任何其他devise特点的button(即我想保持箭头)。 现在我在viewDidAppear:使用这个viewDidAppear:设置正常的条形button项目的字体。 for (NSObject *view in self.navigationController.navigationBar.subviews) { if ([view isKindOfClass:[UIButton class]]) { [((UIButton*)view).titleLabel setFont:[UIFont fontWithName:@"Gill Sans" size:14.0]]; } } 但是,不pipe这个代码应用于哪个UIViewController (root,current等),后退button都不会改变。

UIFont的点数是多less?

我正在努力了解UIFont的点的大小究竟是什么意思。 这不是像素,它似乎不是标准的定义,它是关于1/72英寸。 我使用各种大小的字体-[NSString sizeWithFont:]来计算像素大小,并得到以下结果: | Point Size | Pixel Size | | ———- | ———- | | 10.0 | 13.0 | | 20.0 | 24.0 | | 30.0 | 36.0 | | 40.0 | 47.0 | | 50.0 | 59.0 | | 72.0 | 84.0 | | 99.0 | 115.0 | | 100.0 | 116.0 […]

如何从otf或ttf文件获取字体名称?

我在我以前的应用程序中使用了自定义字体。 文件名是“ProximaNova-Regular.otf”,并加载我刚刚使用的字体… [UIFont fontWithName:@"ProximaNova-Regular" size:20]; 这工作完美。 现在在这个新的应用程序,我有三个字体文件… Dude_Willie.otf Impact handsean.ttf 但我不知道如何加载这些。 我努力了 [UIFont fontWithName:<the file name> size:20]; 但是这只是回到使用Helvetica。 我怎样才能find使用什么名字?

在iOS UILabel上设置BOLD字体

我已经使用Interface Builder为UILabel中的文本分配了大小为14的“Helvetica”自定义字体。 我在多个地方使用相同的标签,但在某些地方,我必须以粗体显示文本。 有没有什么办法可以指定使现有的字体粗体,而不是再次创build整个UIFont? 这就是我现在所做的: myLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:14];

UIFont – 如何获得系统精简的字体

UIFont有获取常规字体( systemFontOfSize )或粗体字体( boldSystemFontOfSize )的方法,但是如何通过storyboard获得“精简系统字体”? 将“system-thin”传递给UIFont不起作用,此构造函数仅适用于非系统字体。