Swiftワン・ピース・コード:角丸のUIButtonを貼り付ける

こんにちは。川上です。
角丸できるボタンは、なんとなく気に入りで使っています。
// 枠に丸みをつける
ovrRemaidReqBtn.layer.cornerRadius = 25 //←任意値ね。
で、角丸になります。
// MARK: === 2-1 リマインダ通知ボタン ー ovrRemaidReqBtnを作成 =========== let sendbtnX = (toolBarView.frame.width - (ovbtnWH * 4)) / 2 ovrRemaidReqBtn = UIButton(frame: CGRect(x:sendbtnX, y:lrbtnY, width:ovbtnWH * 4, height:ovbtnWH )) ovrRemaidReqBtn.backgroundColor = UIColor.red // 枠に丸みをつける ovrRemaidReqBtn.layer.cornerRadius = 25 // ボタンが押されたときの文字色 ovrRemaidReqBtn.setTitleColor(UIColor.red, for: UIControlState.highlighted) ovrRemaidReqBtn.setTitle("リマインダー通知要求", for: UIControlState.normal) ovrRemaidReqBtn.addTarget(self, action: #selector(MainRegNtyVwController.clickedBtn(_:)), for: .touchUpInside) ovrRemaidReqBtn.tag = TAG_TOOLBTN_SEND toolBarView.addSubview(ovrRemaidReqBtn)
こんな感じで、大きさや色を変えると、ハイカラになります(よね?)。
ではでは。