• 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: UIButton's Sender Control Events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UIButton's Sender Control Events


  • Subject: Re: UIButton's Sender Control Events
  • From: Chunk 1978 <email@hidden>
  • Date: Sun, 24 Jan 2010 18:38:32 -0500

i meant it's clear that it's not possible with UIControlEvents... or
at least not simply so.

On Sun, Jan 24, 2010 at 6:35 PM, Graham Cox <email@hidden> wrote:
>
> On 25/01/2010, at 10:22 AM, Chunk 1978 wrote:
>
>> i wanted to simplify the code (one button per method) by using the
>> buttons UIControlEvents of touchDown and touchUpInside/touchUpOutside
>> and produce:
>>
>> - (IBAction)toggleLight
>> {
>> //toggle light
>> }
>>
>> it's clear now that it's not possible.
>
>
> Of course it is - I use toggle type actions pretty often, like this:
>
> - (IBAction) toggleSomething:(id) sender
> {
>    [self setState:![self state]];
> }
>
> The button state itself has no bearing on the toggled state.
>
> If you want something like a checkbox action, where the state follows the checkbox:
>
> - (IBAction) checkboxAction:(id) sender
> {
>    [self setState:[sender state]];
> }
>
>
> --Graham
>
>
>
_______________________________________________

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: 
 >UIButton's Sender Control Events (From: Chunk 1978 <email@hidden>)
 >Re: UIButton's Sender Control Events (From: Chunk 1978 <email@hidden>)
 >Re: UIButton's Sender Control Events (From: Alexander Spohr <email@hidden>)
 >Re: UIButton's Sender Control Events (From: Chunk 1978 <email@hidden>)
 >Re: UIButton's Sender Control Events (From: Graham Cox <email@hidden>)
 >Re: UIButton's Sender Control Events (From: Chunk 1978 <email@hidden>)
 >Re: UIButton's Sender Control Events (From: Chunk 1978 <email@hidden>)
 >Re: UIButton's Sender Control Events (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: UIButton's Sender Control Events
  • Next by Date: Re: NSURL crash
  • Previous by thread: Re: UIButton's Sender Control Events
  • Next by thread: Re: UIButton's Sender Control Events
  • Index(es):
    • Date
    • Thread