xcode - Swift class to interact with Interface Builder via IBOutlet -


Good evening everyone,

I'm slowly working through my first OS X app I am In order to interact with NSPopUpButton, I have been having difficult times for my SWIFT class to ensure that I was correcting it, I created a new project and wiped all the entries and the text was appended to the NSPopup Button Erased through delilet. However, as soon as I try to move the same functionality in my own classroom, I can not even get IBotlet connections up to the new category.

Is a new class necessary for a specific class to work properly with the interface builder?

Here is a screenshot of the class I created, as well as AppDelegate where I am trying to call the function related to this class.

imgur.com/3H7oXRz

Finally, here IB element in question, should I be able to choose my own class under the 'custom class' inspector?

imgur.com/3H7oXRz,24uE4rl#1

I'm an iOS developer, but I think the same situation will apply to your situation.
The interface built into a View Controller Class and Interface Builder is two different things. Although it may appear that they are connected through an iboutlet, they are actually free and can be instantiated without each other. At present, you can only view your view controller class as your App Rep Are making an example - and this is all about - and this is all. The system does not know that your EXB is also present! If your app adds your XB to your View controller class, the outlets will only be connected.
How do we do this? This is actually very simple, rather than making our view controller instantaneously:

  see Controller = View Controller ()   

We will try our View Controller Our xib will add it immediately: nibName is saying / <> your xib file name system, and NSBundle (). The main bundle is telling the system where to look for xib
all this will work only if you have a custom class assigned as you mentioned in your xib interface builder, complete Select view controller. After that, in the Custom Word Inspector type in the name of your ViewController class (in your case: ViewController - it must be auto-complete). This will ensure that your outlets are connected.
And you should be set up !! Tell me if you have more problems - Good luck!

Edit: This changes the first part of my answer, though the part of the linking of things in the storyboard is true. On reconsidering, I believe that I have realized that we are only making the visual controller, and we are not adding it to our idea, I believe that we will see one view as its visual controller sub- Add a method to the square (which we had set in the storyboard) and take a brief cut solution. Start typing in viewDidLoad , and it should be autocomplete type super.viewDidLoad () at the beginning of the file, then self.listUpdate () < type / code>. Classrooms are correctly added in the storyboard, so it should work. This means that you can remove the variable created in app delegate.

Context : You can also find Apple's document to make a visual controller easier (this objective is online in C, but it can be easily converted to swift Is - it reflects that concept):

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -