【发布时间】:2015-06-24 11:57:52
【问题描述】:
floatingButton = UIButton(x: blocx, y:blocy, width: imageSize, height: imageSize, target: self, action: "clickedFloatingButton")
floatingButton!.backgroundColor = CozyColors.StatCardSkip
floatingButton!.layer.cornerRadius = floatingButton!.frame.size.width / 2
floatingButton!.setTitle("+", forState: UIControlState.Normal)
floatingButton!.setTitleColor(CozyColors.ThemeWhite, forState: UIControlState.Normal)
floatingButton!.titleLabel?.font = UIFont(name: CozyStyles.ThemeFontName, size: imageSize*2/3)
view.addSubview(floatingButton!)
结果如下:
如您所见,加号按钮未正确对齐到中心。如何在不添加 UILabel 作为子视图的情况下将其放在中间?
【问题讨论】:
-
恐怕你不能
标签: ios swift uibutton uilabel