• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Selecting UIButtons with code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selecting UIButtons with code


  • Subject: Re: Selecting UIButtons with code
  • From: Eric Dolecki <email@hidden>
  • Date: Thu, 29 Sep 2011 09:43:29 -0400

Haha omg thanks :)

Sent from my iPhone

On Sep 29, 2011, at 9:03 AM, John Andersson <email@hidden> 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:
>
>> 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@hidden)
>>
>> 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:
>>
>> This email sent to email@hidden
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Selecting UIButtons with code (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Selecting UIButtons with code (From: John Andersson <email@hidden>)

  • Prev by Date: Re: Core Data : Undo Delete : Cannot fulfill a fault
  • Next by Date: NSDocument-oriented app and -keydown
  • Previous by thread: Re: Selecting UIButtons with code
  • Next by thread: Re: Selecting UIButtons with code
  • Index(es):
    • Date
    • Thread