I have linked a set of buttons to and IBOutletCollection NSMutableArray; I want to be able to make each button play a specific sound; However after linking them I realised they were not added in any particular order. I think the interface builder doesn't take into account the order of the added buttons. Is there any way I could possibly access the interface button id through code and cast it as an integer so I could programatically assign the right sound to the right button?
Don't think is necessary but here is my code:
for(int i=0;i<48;i++){
UIButton *Pad=[UIButton alloc];
[Pads addobject:Pad];
[Pad release];
[[Pads objectAtindex:i] addTarget:self action:@selector(play:) forControlEvents:UIControlEventTouchUpInside];
((UIButton*)[Pads objectAtIndex:i]).tag=i;
}
To be more specific. In the interface builder in the atributes inspector each button has a label and an id. Would it be possible to reorder my array programatically using that id(or label for that matter)?
FIXE by sorting by TITLE [button currentTitle]