I am using a UITableView to present a variety of viewControllers. Depending on which index is clicked, it will present a different view controller, which can then be dismissed. For some reason one of my ViewControllers takes two clicks to display. Thus, it seems every other click is working. Other view presentations work okay, so the table is probably okay.
What I see in the ViewController about to be displayed is that on the first click, it makes it through didSelectRowAtIndexPath and then fires in the target view: ViewWillLoad, ViewLoaded, ViewWillAppear.... but not ViewDidAppear. On the second click, only ViewDidAppear will fire as it displays. On the second click it doesn't even go through didSelectRowAtIndexPath. Also, I can click anywhere on the screen on the second time and it will display.
It will continue to do this back and forth, seemingly only displaying the target view every other click. Any thoughts why this is occuring?
/* RightPanelViewController */ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { switch(indexPath.row){ case 0: // this view takes two clicks to display [self presentViewController:self.delegateRef.savedRidesViewController animated:YES completion:nil]; break; case 1: // this works fine, as do others [self presentViewController:self.delegateRef.sensorsViewController animated:YES completion:nil]; break; case 2: ... } /* savedRidesViewController */ - (void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } - (void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; }
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With