Hi All, I have a UI with a lot of UISliders and UISwitches. For every single one I have an IBAction which updates an internal variable, I also have a pointer to every control in my controller so if a variable is updated programmatically it's updated in the UI. In my game's update loop I check those variables and act accordingly. I'm wondering if this is the best way to do this? I thought I could have one IBAction to handle all UIControls and just give them all different tags and have my parameters in an array etc, but still its a bit of a pain. There is a lot of variables, and every time I want to add a new parameter I need to:

- add a pointer to the control in the controller
- add an IBAction callback and set my internal variable
- add the control to a updateUI function which simply writes all variables to the controls to update the UI - add the control to a readUI function which simply calls the callback for all of the controls to update the vars.

but I was wondering if I could just directly use the controls in my update loop? I would only use them once per update loop (for loops etc. I would cache the value first if need be). E.g. if (mySwitch.on) or velocity = velSlider.value? Or will this be slow? Is there a preferred method for these situations?


Memo (Mehmet S. Akten)
        www.memo.tv
www.twitter.com/memotv
www.vimeo.com/memotv


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to