我不知道如何更改按钮大小。我该怎么办?有人能告诉我吗?这是我的代码:
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)
答案 0 :(得分:0)
您只需更改
的值即可CGRectMake(140, 400, WIDTH_YOU_WANT, HEIGHT_YOU_WANT)
更改字体:
playAgain.titleLabel!.font = UIFont(name: "Arial-MT", size: 20)
改变" Arial-MT"对于你想要的任何系统字体(注意名称或它会给你一个错误)。