PDA

View Full Version : Control Arrays...




louden
Aug 2, 2008, 04:55 PM
Here's a an issue I'm having:

I'm trying to create control array of buttons on a controller, and have a subview place to them on the screen. A scenario like the Stocks App.

I can get the buttons to layout and look exactly how I want, but when I implement the buttons as an array of buttons (NSMutableArray), I can't get the action to fire in the controller.

If I remove the array and just create a bunch of buttons - it works (just longer-winded code).

Should I be able to do this? I'm wondering if when I pass the controls as views to the subview if I'm losing something or not retaining something I should...

Any ideas? any examples of button control arrays? All the samples are individual buttons



louden
Aug 17, 2008, 03:18 PM
Well, this thread had a lot of activity!

I found out my issue.

First off, Objective C can handle exactly what I wanted to do with Control Arrays.

My issue? I was creating multiple UIViews with one that I thought was in the background, but was over the top of my control array. The action never hit my controls.

If I change the order of how I lay things out in my view - they work. Therefore, there's an idea of a Z Order to controls in a View.

voinguyen
Jan 3, 2009, 08:47 PM
Hi louden,

Can you show me how to create an array of controls?
I am stuck with this problem myself and I noticed you solved your problem.

Also, how do you change the z-order for multiple controls?