How can I return to the previous view programmatically without a UINavigationController?

How can I return to the previous view programmatically without UINavigationController, because all the examples I found use it UINavigationController?

I am pretending to send feedback, and I would like to use this view in many other applications. If I use the UINavigationController than the application should have UINavigationControllerin order to use my view to send feedback.

Can this be done and how?

This is the code as I show my view for submitting reviews:

- (IBAction)showFeedbackView:(id)sender {

    WOC_FeedbackViewController *feedbackView = [[WOC_FeedbackViewController alloc] init];

    [self presentViewController:feedbackView animated:YES completion:nil];
}
+4
source share
3 answers

Use this to return

[self dismissViewControllerAnimated:YES completion:nil];
+9
source

, (Storyboards XIB), presentViewController. viewController.

viewController NSString * yourID;

1) viewController

UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:yourID];

XIB

UIViewController *vc = [UIViewController alloc]initWithNibName:yourID bundle:nil];

2) ViewController

[self presentViewController:vc animated:YES completion:nil];

P.S , navigationController, viewController , , , . , UINavigationController iOS, App Store.

0

In Swift, you can use the following line of code to return to the previous view controller without a navigation controller :

self.dismissViewControllerAnimated(true, completion: nil)
0
source

Source: https://habr.com/ru/post/1541105/


All Articles