Very very strange! It works everywhere but here:
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
MyViewController* cliente = [[MyViewController alloc] initWithModeAndClientId:2 c:cid];
cliente.delegate = self;
UINavigationController *n = [[UINavigationController alloc] initWithRootViewController:cliente];
n.navigationBarHidden = NO;
[[n navigationBar] setBarStyle:UIBarStyleBlack];
[self presentViewController:n animated:YES completion:nil];
}
If I tap by a single click on the row, the MyViewController
shows after seconds!
If I click twice, it shows rapidly!
In the Profiler, at single click nothing happens...
I have no didDeselectRowAtIndexPath
method.
The solution is to put on the main thread the loading of the second controller
dispatch_async(dispatch_get_main_queue(), ^{
// Code here
});
Its issue of threading, when you tap a row in tableview it start a new thread so the presenting a view may take longer to show up on screen.
The solution is:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
dispatch_async(dispatch_get_main_queue(), ^{
MyViewController* cliente = [[MyViewController alloc] initWithModeAndClientId:2 c:cid];
cliente.delegate = self;
UINavigationController *n = [[UINavigationController alloc] initWithRootViewController:cliente];
n.navigationBarHidden = NO;
[[n navigationBar] setBarStyle:UIBarStyleBlack];
[self presentViewController:n animated:YES completion:nil];
});
}
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