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
>
> - (IBAction)clickedButton:(id)sender {
>
> int tag = [sender tag];
>
> for(int i=1;i<5;i++){
>
> UIButton *button = (UIButton *)[self.view viewWithTag:tag];
>
> if(i != tag){
>
> [button setSelected:NO];
>
> } else {
>
> [button setSelected:YES];
>
> }
>
> }
>
> ...
>
>
> What am I missing here?
> _______________________________________________
>
> Cocoa-dev mailing list ([email protected])
>
> 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/john_mlbox%40peekaboo.se
>
> This email sent to [email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]