I have a UITableViewController in a Storyboard. I have the selection of my UITableViewCell prototype trigger a segue to present another controller. The presentation itself i
In my case, the solution ended up being to call performSegue
manually from didSelectRow
on the main queue using GCD instead of using the UITableViewCell
selection outlet in Storyboard.
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
dispatch_async(dispatch_get_main_queue(), ^{
[self performSegueWithIdentifier:kShowDetailSegue
sender:nil];
});
}
I'm not sure why this became necessary- certainly you'd think that the selection outlet in Storyboard would operate on the main queue, but maybe it is an iOS 8 bug.
Carlos Vela is right, the bug is accouring only when UITableViewCell selection is none and only on real device. Waking up CFRunLoop after selection solves the problem and this led me to this "universal" workaround (which is a category on UITableViewCell).
UPDATE: it works perfectly under iOS7 but under iOS8 it brokes transparent UITableViewCell background (it will be white).
#import <objc/runtime.h>
@implementation UITableViewCell (WYDoubleTapFix)
+ (void)load
{
Method original, swizzled;
original = class_getInstanceMethod([UITableViewCell class], @selector(setSelected:animated:));
swizzled = class_getInstanceMethod([UITableViewCell class], @selector(mySetSelected:animated:));
method_exchangeImplementations(original, swizzled);
}
- (void)mySetSelected:(BOOL)selected animated:(BOOL)animated
{
[self mySetSelected:selected animated:animated];
CFRunLoopWakeUp(CFRunLoopGetCurrent());
}
@end