• 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
UITouch's function locationInView not working with iOS4.2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UITouch's function locationInView not working with iOS4.2


  • Subject: UITouch's function locationInView not working with iOS4.2
  • From: Angelica Grace Tanchico <email@hidden>
  • Date: Wed, 3 Nov 2010 15:01:54 +0800
  • Importance: Normal

Hello,

Why is it that UITouch's function locationInView not working with iOS4.2?

I have a table view with a UISwitch on each cell and added an action for a value change event.
It was successfully running with iOS4.1 and below but with iOS4.2, it is not working.

Do you have any suggestion how get a table view's row with a touch event? How?
Thanks in advance!

My code snippets are below:

CREATION OF UISWITCH:

<<snip>>

UISwitch *switchCtl = [[UISwitch alloc] initWithFrame:frame];
[switchCtl addTarget:self action:@selector(switchAction:event:) forControlEvents:UIControlEventValueChanged];

<<snip>>


THE switchAction() FUNCTION:

- (void)switchAction:(id)sender event:(id)event
{
    NSSet *touches = [event allTouches];
    UITouch *touch = [touches anyObject];

    CGPoint currentTouchPosition = [touch locationInView: self.tblView];
    NSLog(@"switchAction: x=%f, y=%f", currentTouchPosition.x, currentTouchPosition.y);

    NSIndexPath *indexPath = [self.tblView indexPathForRowAtPoint: currentTouchPosition];
    NSLog(@"switchAction: indexPath.row = %d", indexPath.row);

    <<snip>>
}


Regards,
Angie


 		 	   		  _______________________________________________

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: UITouch's function locationInView not working with iOS4.2
      • From: David Duncan <email@hidden>
  • Prev by Date: Re: 2 Beginner Bindings Questions
  • Next by Date: UITouch's function locationInView not working with iOS4.2‏ (cont)
  • Previous by thread: Re: 2 Beginner Bindings Questions
  • Next by thread: Re: UITouch's function locationInView not working with iOS4.2
  • Index(es):
    • Date
    • Thread