about using Navigationcontroller, the solution to the problem of the right slip gesture failure is the different hidden properties of the front and rear 2 view controllers Navigationbar

Source: Internet
Author: User

# # #1. Problem Description: If A is a navigationcontroller rootviewcontroller, on this page Navigationbar is displayed (hidden property is NO), it pushes Tumbler stack come over the B view Controller, b page Navigationbar is not displayed (hidden property is yes), there is a chance to appear, B to right-slide pop himself to Tumbler stack A, the right swipe gesture will be invalidated, even if B set Self.navigationController.interactivePopGestureRecognizer.enabled = yes also does not work
# # #2. Problem analysis: In fact, the right slip gesture is blocked, the gesture still exists, need to rewrite its proxy method, so that the gesture is not blocked
# # #3. Resolution steps:
# # # #1. Write this line of code on page B: self.navigationController.interactivePopGestureRecognizer.delegate = self;

# # # #2. Let b page comply with UIGESTURERECOGNIZERDELEGATE protocol

# # # #3. Overriding the Gesturerecognizerdelegate method:
-(BOOL) Gesturerecognizershouldbegin: (Uigesturerecognizer *) gesturerecognizer{
if (Self.navigationController.viewControllers.count <= 1) {
Return no;//prevents the B page from being present, there is only one page, and the right swipe gesture is not available at this time
}
return YES;
}

about using Navigationcontroller, the solution to the problem of the right slip gesture failure is the different hidden properties of the front and rear 2 view controllers Navigationbar

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.