我需要更改文本的大小。我该怎么做?这是我的代码:

  let playAgain: UIButton = UIButton(frame: CGRectMake(140, 400, 100, 50))
  playAgain.setTitle("Play Again", forState: UIControlState.Normal)


  playAgain.addTarget(self, action: "buttonAction:", forControlEvents: UIControlEvents.TouchUpInside)
  playAgain.tag = 1
  self.view!.addSubview(playAgain)

最佳答案

为按钮设置titleLabel.font属性。

playAgain.titleLabel!.font =  UIFont(name: "Helvetica", size: 20)

关于swift - 如何更改按钮的文字大小?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35602174/

10-11 04:28