【发布时间】:2015-02-26 14:56:00
【问题描述】:
所以我的故事板上有一个 60x60 的按钮并为它设置了一个类。
class CustomRedButton: UIButton {
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.layer.cornerRadius = 0.5 * self.bounds.size.width
self.backgroundColor = UIColor.redColor()
self.titleLabel!.font = UIFont(name: "Futura", size: 25)
self.titleLabel!.textAlignment = .Center
}
}
我想要做的是根据屏幕大小调整按钮的大小以及其中的字体。
【问题讨论】:
-
通过这个关于自适应布局的精彩教程设法解决了大部分问题,但仍然更喜欢用代码来解决...mathewsanders.com/designing-adaptive-layouts-for-iphone-6-plus
标签: ios iphone class swift uibutton