I'd greatly appreciate any insight you could share on the below issues/questions.
Intended Use: I'd like to dynamically change font size based on a UIstepper. In the action triggered after editing the stepper, I try to change the font of a UILabel, cleverly named myLabel.
Code Snippet
@IBAction func changeFont(sender: UIStepper) {
var stepval = sender.value;
sizeLabel.text = NSString(format: "%.1f", sender.value); //change size label to display the size
myLabel.font = UIFont(name: "System", size: CGFloat(stepval)) ; //change myLabel to desired font size
}
Issue/Questions:
- Did I correctly cast the double to a CGFloat in the UIFont (using the CGFloat constructor)
- When I run this, the sizeLabel updates with the numerical font size I'd like myLabel to be, but myLabel does not change in font size. Do I need to force update a view?
Thanks!