how iOS uses UINavigationController to jump to the page to destroy the current page.
is that I jump from page a to page b, and I want to destroy page a.
and how do I pass values to the page.
Thank you, bosses.
how iOS uses UINavigationController to jump to the page to destroy the current page.
is that I jump from page a to page b, and I want to destroy page a.
and how do I pass values to the page.
Thank you, bosses.
one solution is that you don't have to destroy the current page, you just need to go back without going back to the current page.
NavigationController can be returned to rootController.
navigationController?.popToRootViewController(animated: true)
in addition, NavigationController can get all the View Controller in the current navigation stack. You can return to the page you specified. Or destroy any view controller in the stack.
navigationController?.viewControllers
if you pass a value, you should want to ask the forward value, right? There are two ways:
try a page removeFromParentViewController . There are many ways to pass values, depending on your specific needs
is to specify the jump position and skip one or more controllers in your stack. The core method is -(nullable UIViewController *) popViewControllerAnimated: (BOOL) animated;
, just get the controller you want in your navigation.viewControllers. The following code can be referred to slightly. It is a self-written navigation base class, which implements manual control and location assignment of click and return
// .h
@property (nonatomic, assign) NSInteger targetIndex;
@property (nonatomic, copy) void(^backOperStandBy)(void(^handleBack)(BOOL back,NSInteger targetIndex),NSInteger operIndex);
// .m
- (void)sp_popViewController{
if (self.backOperStandBy != nil) {
__weak typeof(self) ws = self;
self.backOperStandBy(^(BOOL back, NSInteger targetIndex) {
if (back) {
ws.targetIndex = targetIndex;
[ws handlePopAction];
}
}, self.viewControllers.count-1);
} else {
[self handlePopAction];
}
}
- (void)handlePopAction
{
if (self.targetIndex == RootIndex) {
[self popToRootViewControllerAnimated:YES];
return;
}
if (self.targetIndex != 0 && self.targetIndex > 0) {
UIViewController *target = self.viewControllers[self.targetIndex];
self.targetIndex = 0;
if (target) {
[self popToViewController:target animated:YES];
}else{
[self popViewControllerAnimated:YES];
}
return;
}
//
[self popViewControllerAnimated:YES];
}
reference: https://github.com/rickytan/R.
generally speaking
self.navigationController?.setViewControllers([B_ViewController], animated: true)
as mentioned above, how to implement it in OC? ...
I drag the folder containing the Xcode project onto OmniGraffle, and the following dialog box pops up automatically ...
1 want to view the relationship class diagrams in projects written by others, such as inheritance relationships, or member variable relationships. Someone said to create a new file file-> new file-> ios- > other- > class model but I didn t find this op...
[self.scrollView lockFocus]; NSImage image = [[NSImage alloc] initWithData: [(NSView ) self.scrollView.documentView dataWithPDFInsideRect:bounds]]; [self.scrollView unlockFocus]; if the scrolling view is in the same application, it can be achieve...
1. For example, there is no way to realize this at present, please give me some advice. 2. Mixed development technology to open RN, after prohibiting hot updates, will the use of RN, in the project affect the approval? ...
want to achieve an effect, such as album APP, select photos, long press to select multiple photos, when the gesture slides to the bottom of the screen, the view will automatically scroll up to allow users to select more pictures, how should this functio...
problem description do you need to judge the system version number when introducing the header file library? our app supports iOS8.0 at a minimum. I now need to use a library that is only available in iOS9.0. In this case, do you need to judge the sy...
as mentioned above, I am using the native form of h5 + to develop iOS and Android for fast integration and uniform style. but in iOS development, after I jump to the next page, using gestures to return to the navigation bar will turn white, and it is n...
problem description when you do IM live chat, when you receive a message, you will display a small red corner sign on the icon of App, and there are several unread messages. Then the chat list shows the number of unread messages for a specific person,...
if you add the addChildViewController sub-viewController, there is still no response < hr > - (void)viewDidLoad { [super viewDidLoad]; Do any additional setup after loading the view. UIButton *btn = [[UIButton alloc]initWithFra...
iOS uses pod to search and install DifferenceKit prompts that the installation failed and could not be found. Is there any way to solve it? Or the problem of uploading by the author himself. All other pod libraries are normal: Unable to find a pod wit...
as shown in the following figure: : :suggestSizetotalHeight : the impact is not known yet. ps: Android side can be displayed normally with no error in height. ...
how to add permissions to iOS frontend, java backend and grpc? there is no official demo with permission, so there is no problem without permission. If you add permission to Android, you can t solve it on iOS. On the Android side, it is done in recei...