• 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: Tracking Multiple Touches For Appropriate Label
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tracking Multiple Touches For Appropriate Label


  • Subject: Re: Tracking Multiple Touches For Appropriate Label
  • From: Chunk 1978 <email@hidden>
  • Date: Tue, 8 Dec 2009 19:04:47 -0500

i'm very grateful for your help.  thanks so much for posting such a
complete solution.  i'm certain there will be others like myself who
will find your code extremely helpful.  thanks again.

On Tue, Dec 8, 2009 at 5:24 PM, mmalc Crawford <email@hidden> wrote:
>
> On Dec 8, 2009, at 12:33 pm, mmalc Crawford wrote:
> Get the logic right...
>
>> - (void)setUpTouchHandling {
>>
>>    touchToLabelMapping = CFDictionaryCreateMutable (kCFAllocatorDefault, 5, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
>>    availableLabels = [[NSMutableArray alloc] initWithObjects:touchLabel1, touchLabel2, touchLabel3, touchLabel4, touchLabel5, nil];
>> }
>>
> - (void)setUpTouchHandling {
>
>    touchToLabelMapping = CFDictionaryCreateMutable (kCFAllocatorDefault, 5, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
>    availableLabels = [[NSMutableArray alloc] initWithObjects:touchLabel1, touchLabel2, touchLabel3, touchLabel4, touchLabel5, nil];
>    setUp = YES;
> }
>
>
> ... and improve the user experience accordingly:
>
>> - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
>>
>>    for (UITouch *touch in touches) {
>>        if (touch.view == self) {
>>            UILabel *label = (UILabel *)CFDictionaryGetValue(touchToLabelMapping, touch);
>>            label.text = @"{0, 0}";
>>            CFDictionaryRemoveValue (touchToLabelMapping, touch);
>>            [availableLabels addObject:label];
>>        }
>>    }
>> }
>>
> - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
>
>    for (UITouch *touch in touches) {
>        if (touch.view == self) {
>
>            UILabel *label = (UILabel *)CFDictionaryGetValue(touchToLabelMapping, touch);
>            label.text = @"{0, 0}";
>            CFDictionaryRemoveValue (touchToLabelMapping, touch);
>            [availableLabels insertObject:label atIndex:0];
>        }
>    }
> }
>
>
> (I'm using setUpTouchHandling so that this will work however you configure your view or view controller -- ideally you choose a more appropriate initialisation locus.)
>
> mmalc
>
>
> _______________________________________________
>
> 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

  • Follow-Ups:
    • Re: Tracking Multiple Touches For Appropriate Label
      • From: Chunk 1978 <email@hidden>
References: 
 >Tracking Multiple Touches For Appropriate Label (From: Chunk 1978 <email@hidden>)
 >Re: Tracking Multiple Touches For Appropriate Label (From: mmalc Crawford <email@hidden>)
 >Re: Tracking Multiple Touches For Appropriate Label (From: Chunk 1978 <email@hidden>)
 >Re: Tracking Multiple Touches For Appropriate Label (From: Graham Cox <email@hidden>)
 >Re: Tracking Multiple Touches For Appropriate Label (From: Chunk 1978 <email@hidden>)
 >Re: Tracking Multiple Touches For Appropriate Label (From: mmalc Crawford <email@hidden>)
 >Re: Tracking Multiple Touches For Appropriate Label (From: Chunk 1978 <email@hidden>)
 >Re: Tracking Multiple Touches For Appropriate Label (From: mmalc Crawford <email@hidden>)
 >Re: Tracking Multiple Touches For Appropriate Label (From: mmalc Crawford <email@hidden>)

  • Prev by Date: Finding process path from Cocoa?
  • Next by Date: Re: odd problems with NSData / OpenGL
  • Previous by thread: Re: Tracking Multiple Touches For Appropriate Label
  • Next by thread: Re: Tracking Multiple Touches For Appropriate Label
  • Index(es):
    • Date
    • Thread