Code
  • 首页
  • cpu-architecture
  • performance
  • c++
  • branch-prediction
  • java
2024-07-18 07:00:02

我如何改变一个UILabel的字体大小在Swift?

xcodeiosuilabelcocoa-touchswift

label.font.pointSize是只读的,所以我不确定如何更改它。


当前回答

你也可以这样给予

labelName.font = UIFont(name: "systemFont", size: 30)
2014-10-27 13:33:02

其他回答

你也可以这样给予

labelName.font = UIFont(name: "systemFont", size: 30)
2014-10-27 13:33:02

斯威夫特3

label.font.withSize(16)
2017-03-16 07:51:16
label.font = UIFont.systemFontOfSize(20)
2015-01-30 16:48:19

再次在Swift 3中…

myLabel.font = myLabel.font.withSize(18)
2016-10-23 19:41:31

在Swift 3中:

label = UIFont.systemFont(ofSize: 20)

并使用系统预设的大小,例如:

label = UIFont.systemFont(ofSize: UIFont.smallSystemFontSize)
2016-10-13 18:08:02

推荐文章

  • 如何删除默认的导航栏空间在SwiftUI导航视图
  • Ios模拟器:如何关闭应用程序
  • 准备好开发人员ID的macOS安装程序包
  • 创建配置文件失败
  • 如何在iOS中使用Swift编程segue
  • Swift -整数转换为小时/分钟/秒
  • 如何舍入一个双到最近的Int在迅速?
  • 扁平化数组的数组在Swift
  • Swift:声明一个空字典
  • 在成功提交我的应用程序后,“太多符号文件”
  • 从数组中随机选择一个元素
  • 首先添加一个UIView,甚至是导航栏
  • 复制并重命名Xcode项目和相关文件夹
  • 我如何改变UIButton标题颜色?
  • 如何从UIImage (Cocoa Touch)或CGImage (Core Graphics)获取像素数据?

aliyun

最新文章

  • 如何删除默认的导航栏空间在SwiftUI导航视图
  • 我可以列出所有的标准Go包吗?
  • 证书验证失败:无法获得本地颁发者证书
  • 警告:API ' variable . getjavacompile()'已过时,已被' variable . getjavacompileprovider()'取代
  • 打开同一目录两次
  • 实体框架核心:在上一个操作完成之前,在此上下文中开始的第二个操作
  • NullInjectorError: AngularFirestore没有提供程序
  • 如何为构造函数定制Visual Studio的私有字段生成快捷方式?
  • 从元组/数组值派生联合类型
  • 如何在Angular2中截断文本?
  • 安装tzdata非交互式
  • ionic 2 - Error在Android Studio中找不到Gradle的安装版本
  • 如何查看所有地区所有正在运行的Amazon EC2实例?
  • 当使用pip3安装包时,“Python中的ssl模块不可用”
  • 安装APK时出现错误

标签

cpu-architectureperformancec++branch-predictionjavaundogit-commitgitversion-controlgit-remotegit-pushgit-branchgit-pullgit-fetchpythongeneratoriteratorjsonmime-typescontent-typearraysjavascriptgit-addcode-formattingcstandards-complianceoperatorscommentsdynamic-memory-allocationstackmemory-managementheap-memorylanguage-agnosticoverwritebackground-colorbrowserhtmldomjqueryvisibilityuse-strictsyntaxjslintremote-branchgit-checkoutpython-moduleidiomsprogram-entry-pointnamespacesbranch
2025 code 京ICP备15047053号-1