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条)