Reputation: 113
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.
Upvotes: 0
Views: 148
Reputation: 75067
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.
Upvotes: 0
Reputation: 113
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.
Upvotes: 0
Reputation: 10860
You can enable NSTimer on touchesBegan:withEvent and disable it on touchesEnded:withEvent.
Upvotes: 1