PDA

View Full Version : Multiple hidden toolbar buttons vs single dynamically changing button (best practice)



jonathansimmons
26 Apr 2012, 2:41 PM
So I'm developing an app based around a navigation view. At various times in the app I'm showing and hiding buttons in the navigationBar. As of now I've created a separate button for each action needed and set it hidden by default, showing/hiding as necessary.

This morning I though of an alternative: Say I had 10 buttons that display in the toolbar at different times throughout my app. I could reduce the numbers of buttons I actually instantiate by reusing buttons that have the same purpose, (a done button for a form for example).

So say I have a 3 done buttons for 3 separate forms. I could essentially use the same button for each form by setting the action of that button to be relevant to the form.

Anyone have any thoughts on what might be better for performance? more buttons super specific, less buttons with dynamically set actions....

mitchellsimoens
28 Apr 2012, 4:35 AM
If you can consolidate number of components you use is very much suggested for performance as long as you don't have to do too much to reuse.

I often use the action custom property on buttons and in the controller have listeners for button with certain actions. This would be very easy to change the action property and set the text.