OC UIFont字体设置

1 篇文章 0 订阅
1 篇文章 0 订阅
UIFont 三种格式:
  1. UIFont *font =[UIFont systemFontOfSize:20];  标准字体
  2. UIFont *font =[UIFont italicSystemFontOfSize:20]; 斜体
  3. UIFont *font =[UIFont boldSystemFontOfSize:20]; 粗体
  4. fwmk6km

大小标准:

  1. UIFont *font = [UIFontsystemFontOfSize: [UIFontbuttonFontSize]];  button标准
  2. UIFont *font=  [UIFontsystemFontOfSize:[UIFontlabelFontSize]];  label标准
  3. UIFont *font =[UIFontsystemFontOfSize:[UIFontsmallSystemFontSize]]; 比标准小

在IOS系统中我们用到的字体集包含一下几种 :

Font Family: American Typewriter( AmericanTypewriter,AmericanTypewriter-Bold)
Font Family: AppleGothic(AppleGothic)
Font Family: Arial(ArialMT,Arial-BoldMT,Arial-BoldItalicMT,Arial-ItalicMT)
Font Family: Arial Rounded MT Bold(ArialRoundedMTBold)
Font Family: Arial Unicode MS(ArialUnicodeMS)
Font Family: Courier(Courier,Courier-BoldOblique,Courier-Oblique,Courier-Bold)
Font Family: Courier New(CourierNewPS-BoldMT,CourierNewPS-ItalicMT,CourierNewPS-BoldItalicMT,CourierNewPSMT)
Font Family: DB LCD Temp (DBLCDTempBlack)
Font Family: Georgia( Georgia-Bold, Georgia,Georgia-BoldItalic,Georgia-Italic)
Font Family: Helvetica(Helvetica-Oblique,Helvetica-BoldOblique,Helvetica,Helvetica-Bold)            默认字体
Font Family: Helvetica Neue(HelveticaNeue,HelveticaNeue-Bold)
Font Family: Hiragino Kaku Gothic **** W3(HiraKakuProN-W3)
Font Family: Hiragino Kaku Gothic **** W6(HiraKakuProN-W6)
Font Family: Marker Felt( MarkerFelt-Thin)
Font Family: STHeiti J  (STHeitiJ-Medium,STHeitiJ-Light)
Font Family: STHeiti K( STHeitiK-Medium, STHeitiK-Light)
Font Family: STHeiti SC(STHeitiSC-Medium, STHeitiSC-Light)
Font Family: STHeiti TC(STHeitiTC-Light,STHeitiTC-Medium)
Font Family: Times New Roman(TimesNewRomanPSMT,TimesNewRomanPS-BoldMT, TimesNewRomanPS-BoldItalicMT, TimesNewRomanPS-ItalicMT)
Font Family: Trebuchet MS( TrebuchetMS-Italic,TrebuchetMS,Trebuchet-BoldItalic,TrebuchetMS-Bold)
Font Family: Verdana( Verdana-Bold,Verdana-BoldItalic, Verdana,Verdana-Italic)
Font Family: Zapfino( Zapfino)



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要改变 UIAlertAction 的字体大小,您可以使用富文本属性来设置 UIAlertAction 的标题的字体大小。下面是一个示例代码: ```objective-c UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"标题" message:@"消息" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { // 点击确定按钮后的处理逻辑 }]; // 创建富文本属性字典 NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:20]}; // 设置字体大小为 20 // 使用富文本属性设置 UIAlertAction 的标题字体大小 NSAttributedString *attributedTitle = [[NSAttributedString alloc] initWithString:@"确定" attributes:attributes]; [action setValue:attributedTitle forKey:@"attributedTitle"]; [alertController addAction:action]; [self presentViewController:alertController animated:YES completion:nil]; ``` 在上面的示例中,我们首先创建了一个 UIAlertController,并设置其标题和消息。然后,我们创建了一个 UIAlertAction,并设置其标题为 "确定",并指定了点击按钮后的处理逻辑。 接下来,我们创建了一个富文本属性字典,其中包含了一个字体大小为 20 的字体属性。然后,使用这个富文本属性设置 UIAlertAction 的标题字体大小。我们将富文本标题设置为 "确定"。 最后,我们将 UIAlertAction 添加到 UIAlertController 中,并通过 presentViewController 方法来显示 UIAlertController。 这样,您就可以改变 UIAlertAction 的字体大小了。请注意,使用私有键 "attributedTitle" 来设置富文本标题是一种非官方的方法,可能会在未来的 iOS 版本中发生变化。如果有其他问题,请随时提问!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值