I'm trying to implement the following button in swift.
Here's what I have so far
let startBtn = UIButton(frame: CGRect(x: (self.view.frame.width - 319)/2, y: progressView.frame.maxY + 10, width: 319, height: 48))
startBtn.backgroundColor = UIColor(red: 0.00, green: 0.83, blue: 0.69, alpha: 1.00);
startBtn.layer.cornerRadius = 40
startBtn.setTitleColor(UIColor.white, for: .normal)
startBtn.titleLabel?.textAlignment = .center
startBtn.contentVerticalAlignment = .center
startBtn.titleLabel?.font = UIFont(name: "CeraPro-Medium", size: 17);
if (self.courseProgress != nil && self.courseProgress >= 0) {
startBtn.setTitle("Resume Course", for: .normal)
} else {
if (hasPurchased) {
startBtn.setTitle("Start Course", for: .normal)
} else {
if let price = self.data.price {
startBtn.setTitle("Buy this course for $\(price)", for: .normal)
}
}
}
startBtn.addTarget(self, action:#selector(self.goToCourse(sender:)), for: .touchUpInside)
headerView.addSubview(startBtn)
Unfortunately, the code above gives me the following
How can I turn that code to look like the design I showed?