Jump to content

fluid | fixed

iPhone connect actions/outlets programmatically


  • Please log in to reply
2 replies to this topic

#1
andyong

andyong

    InsanelyMac Protégé

  • Members
  • Pip
  • 10 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

#2
andyong

andyong

    InsanelyMac Protégé

  • Members
  • Pip
  • 10 posts
Seems like you can wire up actions using something like. Still looking for outlet mapping.

[btn addTarget:self action:@selector(buttonClickActionMethod) forControlEvents:UIControlEventTouchUpInside];

#3
andyong

andyong

    InsanelyMac Protégé

  • Members
  • Pip
  • 10 posts
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.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2013 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   Web hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy