Selecting UIButtons with code

2011-09-29 Thread Eric E. Dolecki
I am missing something simple here. The following code doesn't work. I have 4 UIButtons, tagged 1,2,3,4 - (IBAction)clickedButton:(id)sender { int tag = [sender tag]; for(int i=1;i5;i++){ UIButton *button = (UIButton *)[self.view viewWithTag:tag]; if(i != tag){

Re: Selecting UIButtons with code

2011-09-29 Thread John Andersson
You should probably change to: UIButton *button = (UIButton *)[self.view viewWithTag:i]; (i instead of tag) Regards /John 29 sep 2011 kl. 14:52 skrev Eric E. Dolecki: I am missing something simple here. The following code doesn't work. I have 4 UIButtons, tagged 1,2,3,4 -

Re: Selecting UIButtons with code

2011-09-29 Thread Eric Dolecki
Haha omg thanks :) Sent from my iPhone On Sep 29, 2011, at 9:03 AM, John Andersson john_ml...@peekaboo.se wrote: You should probably change to: UIButton *button = (UIButton *)[self.view viewWithTag:i]; (i instead of tag) Regards /John 29 sep 2011 kl. 14:52 skrev Eric E. Dolecki:

Re: Selecting UIButtons with code

2011-09-29 Thread David Rowland
This line, UIButton *button = (UIButton *)[self.view viewWithTag:tag]; is returning something that is not a UIButton, and it won't respond to setSelected. On Sep 29, 2011, at 5:52 AM, Eric E. Dolecki wrote: I am missing something simple here. The following code doesn't work. I

Re: Selecting UIButtons with code

2011-09-29 Thread Eric E. Dolecki
I had a brain fart. That line DID return a UIButton, but only when the tag matched i :) Google Voice: (508) 656-0622 Twitter: eric_dolecki XBoxLive: edolecki PSN: eric_dolecki http://blog.ericd.net On Thu, Sep 29, 2011 at 6:14 PM, David Rowland rowla...@sbcglobal.netwrote: