views:

53

answers:

3

i have application view with nine icons on each page, i want to call a function when a certain icon is pressed for certain amount of time. similarly i want to do this with a cell in UITableView.

+1  A: 

You can enable NSTimer on touchesBegan:withEvent and disable it on touchesEnded:withEvent.

Morion
A: 

For the icons view have used the TouchDown and TouchUpInside event to acomplish,

Used timeBetweenTouchRelease = [[NSDate date] timeIntervalSince1970]; when TouchDown

and Used the following timeBetweenTouchRelease = [[NSDate date] timeIntervalSince1970] - timeBetweenTouchRelease;

when TouchUpInside.

Still having problem with tablecell, i guess when using touch begin and end user may move his finger so that means user may have moved from one cell to another.

Ali Awais
I think, that if your tableView is scrollable, then user cannot move finger to the other row)
Morion
A: 

The button is easier because of the TouchUpInside and TouchDown events you can react to.

For a cell, you'd probably have to start a timer in setHighlighted:, and disable the timer when setHighlighted was called to unhighlight.

Kendall Helmstetter Gelner
Thanks that was helpful
Ali Awais