1

For iOS7 version of my app I'm implementing side menu control like this one - https://github.com/romaonthego/RESideMenu. This implementation is ver buggy so I decided to reimplement it by myself from scratch. I used this tutorial http://www.doubleencore.com/2013/09/ios-7-custom-transitions/ for practical instructions. Sample code works great. But in my case I need transition from UIViewController (with button tap) to UITableViewController, and back on selecting any table view cell.

The issue is that when a cell in table view is selected and I'm dismissing presented view controller I got delay before actual animation.

    //this cause animation with delay
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        [self.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
    }

I noticed that if after selecting cell I tap anywhere in presented tableview, animation performs.

I added some delay using gcd and that fixed issue:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    double delayInSeconds = 0.1;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        [self.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
    });
}

But it looks ugly to me and also sample code from tutorial I pointed works without this workaround, so I'm wondering if I missed something and why does this happens. TableView selection is set single selection and tableview cell selection style is set to None.

Maybe I should also notice that I'm adding some constraints to tableview for it's height to make it fit it's content. But I think it does not cause this issue as far as I have it without any constraints.

Ilya Puchka
  • 141
  • 1
  • 9

0 Answers0