Table view didSelectRowAtIndexPath, only works after selecting second click
That is because you implemented didDeselectRowAtIndexPath
instead of didSelectRowAtIndexPath
.
UITableView didSelectRowAtIndexPath sometimes called after second tap
Try this.
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
dispatch_async(dispatch_get_main_queue(), {
self.performSegueWithIdentifier("homeToDetail", sender:self)
})
}
This is a bug in iOS 8, I think. UITableViewCell selection Storyboard segue is slow - double tapping works though
iphone - didSelectRowAtIndexPath: only being called after long press on custom cell
same problem happened with me because I have added a tap gesture recogniser over it.
If you have used any gesture recognizer try removing it and check if it causing the problem.
EDIT: Solution as commented by the Ali:
If you have used tap gesture you can use [tap setCancelsTouchesInView:NO];
didDeselectRowAtIndexPath only called after pressing another cell
Are you confused with didSelectRowAtIndexPath
and didDeselectRowAtIndexPath
?
The latter will only be called if it's deselected, hence why it's called after you select another cell.
If you want to call the didDeselectRowAtIndexPath
, then add the method deselectRowAtIndexPath
in didSelectRowAtIndexPath
and it will deselect right way.
UITableView didSelectRowAtIndexPath: not being called on first tap
Any chance you accidentally typed didDeselectRowAtIndexPath?
UITableView and presentViewController takes 2 clicks to display
Check this out: https://devforums.apple.com/thread/201431
If you don't want to read it all - the solution for some people (including me) was to make the presentViewController
call explicitly on the main thread:
dispatch_async(dispatch_get_main_queue(), ^{
[self presentViewController:myVC animated:YES completion:nil];
});
Probably iOS7 is messing up the threads in didSelectRowAtIndexPath
.
Swift ios didSelectItemAt not called until second click
You use didDeselectItemAt
instead of
func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) { }
use
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { }
Issue with UITableView: Action only works every second time
Change didDeselectRowAt to didSelectRowAt
Related Topics
Declaring Global Variables in Swift
Changing Iphone's Date and Time
App Crashes in Background While Changing Permission - Swift
How to Code the Launchscreen Programmatically
How to Unit Test an App Extension on Xcode 6
Cgcontextsetfillcolorwithcolor: Invalid Context 0X0
Which Phassetcollection to Use for Saving an Image
Cordova Xcode Build Failed "Permission Denied"
Xcode 5 - "No Application Records Were Found" When Trying to Validate an Archive
iPhone Only App Rejected for Not Running on iPad
How to Detect the Scroll Direction from the Uicollectionview
Rounding Uiimage and Adding a Border
Animation Blocks Resets to Original Position After Updating Text
iOS Notification When Application Is Closed
How to Get Index(Of:) to Return Multiple Indices