ios自动缩小字体_ios–自动更改字体大小以适应swift中的按钮

ios自动缩小字体_ios–自动更改字体大小以适应swift中的按钮

2023年7月13日发(作者:)

ios⾃动缩⼩字体_ios–⾃动更改字体⼤⼩以适应swift中的按钮我试过这个,但它不起作⽤,⽂本超出按钮边界.abel!.adjustsFontSizeToFitWidth = abel!.numberOfLines = abel!.minimumScaleFactor = 0.1当我尝试以下操作时,所有⽂本都适合,但⽂本仍然是⼩字体:abel!.font = UIFont(name: "Heiti TC",size: 9)如何让字体⾃动适合按钮的⼤⼩?func nextQuestion() {let currentQuestion = mcArray![questionIdx]answers = currentQuestion["Answers"] as! [String]correctAnswer = currentQuestion["CorrectAnswer"] as? Stringquestion = currentQuestion["Question"] as? StringtitlesForButtons()}func titlesForButtons() {for (idx,button) in ate() {abel!.lineBreakMode = .abel!.font = UIFont(name: "Heiti TC",size: 5)abel!.numberOfLines = abel!.minimumScaleFactor = abel!.baselineAdjustment = .abel!.textAlignment = le(answers[idx],forState: .Normal)d = oundColor = UIColor(red: 83.0/255.0,green: 184.0/255.0,blue: 224.0/255.0,alpha: 1.0)} = questionstartTimer()}这是我到⽬前为⽌的代码,它从plist⽂件中获取答案

发布者:admin,转转请注明出处:http://www.yc00.com/news/1689259776a226200.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信