Jump to content

iPhone connect actions/outlets programmatically


3 posts in this topic

Recommended Posts

Hi all,

 

Does anyone know how to connect actions and outlets programmatically? Basically I have a few text fields that are hidden when the view loads, and depending on some user input I want to be able to create some new objects in the viewcontroller or appdelegate and once created call some methods to link those objects via outlets to be able to update those UITextFields, and conversely link actions methods from the UIControl objects to prompt modifications to the created objects.

 

Any help would be appreciated.

 

Thanks,

 

Andy

Link to comment
Share on other sites

  • 2 weeks later...

So here's a little update. The previous post works fine to programmatically link/wire up actions to events on controls like UITextfields, UIButtons, etc. The reason you would be doing this I'd expect is because you are creating these textfields, buttons, etc. programmatically too like myself. In regards to connecting outlets you don't need to worry about this. Once you've created the object for the UITextfield, for example, you can modify properties for it (in particular its .text property) in your code and it is automatically reflected on the drawn object. You don't need to make modifications to the objects then initiate redraw functions as all of that is handled for you.

Link to comment
Share on other sites

 Share

×
×
  • Create New...