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.net>wrote:

> 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
> 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 (Cocoa-dev@lists.apple.com)
> >
> > 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/rowlandd%40sbcglobal.net
> >
> > This email sent to rowla...@sbcglobal.net
>
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to