Do you click between the back button of the UIN access bar and the interactive pop-up slide…

I need to discern between the two methods of going back in iOS – tapping the back button in a navigation bar, and using the screen-edge pan to do so. I’d rather not implement a custom back button if possible.

How might I go about this one?

Figured it out:

I’ve implemented UINavigationControllerDelegate
, declared myself as that delegate, and set up a boolean value called isPanningBack
. Then implemented this guy;

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    id tc = navigationController.topViewController.transitionCoordinator;
    [tc notifyWhenInteractionEndsUsingBlock:^(id context) {
        if (![context isCancelled]) {
            _isPanningBack = YES;
        }
    }];
}

Then, implemented viewDidDisappear:animated
:

- (void)viewDidDisappear:(BOOL)animated
{
    if (!_isPanningBack) {
        // We can be sure that we used the chevron.
    } else {
        // We can be sure that we used the swipe.
    }
    [super viewDidDisappear:animated];
}
Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 移动开发 » Do you click between the back button of the UIN access bar and the interactive pop-up slide…

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录