in OC Development, the navigation controller is a very common control, and in many uses, we need to customize the navigation bar Navigationbar. But this approach can lead to some minor problems, and here are the questions I have and the thinking process of the solutions. Inside the apple, the return function is implemented with a sliding back feature with an edge. But once we use our custom Navigationbar, the sub-controller will disappear. If we use both customization and sliding return, we first need to analyze the reason for the disappearance and then find the solution. Since replacing Navigationbar will result in the disappearance of the sliding return function, we can basically be certain that some of the properties in the Navigationbar are implemented in some way. It is necessary to consider further what the system does and what will cause the sliding function to fail. since the swipe function definitely requires gestures, we can analyze it first from the gesture. And because the swipe return gesture is iOS7.0 later, and the add gesture is added to the Uinavigationcontroller view, then we go directly to the search keyword "gesture" appears with only one attribute that matches our criteria. Then we can boldly speculate that the sliding return function is related to Interactivepopgesturerecognizer, so print its values directly to see. It just has a value that is related to the gesture on the edge of the screen, further validating our conjecture. Then you can use the simplest and most brutal method to confirm, directly "kill" the method, if the function fails, it is certainly related to it, then we can consider to try the agent, through the Interactivepopgesturerecognizer to let the sliding return function failure. First let the controller become the agent of Interactivepopgesturerecognizer, in the proxy method, the return value of the recognition gesture method is changed to No, as expected, the sliding function cannot be realized. In order to verify that the attribute is already present, the Proxy property value is also printed out. This can also prove the correctness of the conjecture. Then the next step is to consider how to use the custom navigation bar (Navigationbar) on the basis of the sliding function to continue to implement. First try to empty the agent property directly, without letting it continue to control the screen swipe, it is true that the return function of sliding continues after customizing the Navigationbar. But obviously also brings the bug, cause the navigation controller view can also slide, and after sliding caused the interface of suspended animation, so can not set the proxy to nil. Then we continue to use the controller as a proxy, considering that the control gesture cannot be slid on the root controller to fix the bug. When gesture control is added to judgment, if the controller is the root controller, then the gesture will not be triggered, if it is a sub-controller, can be used normally. Finally, to achieve the project requirements, the use of custom Navigationbar in the premise of the original sliding return function.
Sliding back the solution that is covered by the function