Why is the slider not updating the label when I make the slider programmatically? <p>I made a slider and label <strong>PROGRAMMATICALLY</strong>. I wanted the label to display the value of the slider, but the label only displays the value I initially assigned.</p> <p>Code:</p> <pre><code>var num: CGFloat = 9 override func viewDidLoad() { let label = UILabel(frame: CGRectMake(0, 0, 60, 40)) label.text = "\(num)" self.view.addSubview(label) let slider = UISlider(frame:CGRectMake(0, 0, 60, 30)) slider.value = Float(num) slider.addTarget(self, action: "changedSliderValue:", forControlEvents: .ValueChanged) self.view.addSubview(slider) } func changedSliderValue(sender: UISlider!){ num = CGFloat(sender.value) label.text = "\(num)" } </code></pre> <p>When I did <code>print(label.text!)</code>, it showed me that <code>label.text</code> was changing as I changed the slider value. But then, why doesn't the label change on my view controller?</p>