ios – Setting a label to a price in Swift on XCode?

[ad_1]

I perceive it’s fairly primary, however I’m solely attempting to get a grasp on primary features.

I’ve produced some code by partially my very own information and partial bits from totally different guides.

I’m not getting any errors, however the label just isn’t displaying itself as “Textual content”. I consider it’s to do with the order/place my code is put.

Please assist clarify how I can repair this!

Please notice as nicely:

  • I’ve only a single label known as myLabel (named beneath the doc part of my the identification inspector
  • It’s has the textual content “Loaded” put into it already after I put it in.
  • I’ve no different code wherever, solely the default new mission code.
  • I renamed the ViewController to ViewManager to keep away from a category error.

First picture: That is the picture simply so you understand the placement and different bits. I’ll connect the code too:

Second picture: What I get, with no errors:

Third picture: My principal storyboard file:

And now it in code:

import UIKit

class ViewController: UIViewController {
   @IBOutlet weak var myLabel: UILabel!
   @IBAction func labelSet() {
       myLabel.textual content = "Textual content"
    }
  }

[ad_2]

Leave a Reply