Pop viewcontroller to another viewcontroller from another navigation Controller
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
NC / VC1 -present modally- NC2 / VC2 (embed in) - VC3 pop to VC1
I am trying to pop current view controller to the first view controller from another navigation controller.
I couldn't find a way. Anyone knows how to achieve?
ios swift uiviewcontroller
|
show 1 more comment
NC / VC1 -present modally- NC2 / VC2 (embed in) - VC3 pop to VC1
I am trying to pop current view controller to the first view controller from another navigation controller.
I couldn't find a way. Anyone knows how to achieve?
ios swift uiviewcontroller
you to pop to VC1 navigation controller not to VC1
– canister_exister
Nov 16 '18 at 17:18
use unwind segue. In VC 1 declare unwind segue on VC 3 create unwind segue and assigned id to segue and perform it.
– Junaid
Nov 16 '18 at 19:32
@Junaid can you show how to do?
– Utku Dalmaz
Nov 16 '18 at 19:33
OK i will show you
– Junaid
Nov 16 '18 at 19:35
Found a simple solution just call this method self.dismiss(animated: true, completion: nil)
– Junaid
Nov 16 '18 at 19:42
|
show 1 more comment
NC / VC1 -present modally- NC2 / VC2 (embed in) - VC3 pop to VC1
I am trying to pop current view controller to the first view controller from another navigation controller.
I couldn't find a way. Anyone knows how to achieve?
ios swift uiviewcontroller
NC / VC1 -present modally- NC2 / VC2 (embed in) - VC3 pop to VC1
I am trying to pop current view controller to the first view controller from another navigation controller.
I couldn't find a way. Anyone knows how to achieve?
ios swift uiviewcontroller
ios swift uiviewcontroller
asked Nov 16 '18 at 15:49
Utku DalmazUtku Dalmaz
2,5922173109
2,5922173109
you to pop to VC1 navigation controller not to VC1
– canister_exister
Nov 16 '18 at 17:18
use unwind segue. In VC 1 declare unwind segue on VC 3 create unwind segue and assigned id to segue and perform it.
– Junaid
Nov 16 '18 at 19:32
@Junaid can you show how to do?
– Utku Dalmaz
Nov 16 '18 at 19:33
OK i will show you
– Junaid
Nov 16 '18 at 19:35
Found a simple solution just call this method self.dismiss(animated: true, completion: nil)
– Junaid
Nov 16 '18 at 19:42
|
show 1 more comment
you to pop to VC1 navigation controller not to VC1
– canister_exister
Nov 16 '18 at 17:18
use unwind segue. In VC 1 declare unwind segue on VC 3 create unwind segue and assigned id to segue and perform it.
– Junaid
Nov 16 '18 at 19:32
@Junaid can you show how to do?
– Utku Dalmaz
Nov 16 '18 at 19:33
OK i will show you
– Junaid
Nov 16 '18 at 19:35
Found a simple solution just call this method self.dismiss(animated: true, completion: nil)
– Junaid
Nov 16 '18 at 19:42
you to pop to VC1 navigation controller not to VC1
– canister_exister
Nov 16 '18 at 17:18
you to pop to VC1 navigation controller not to VC1
– canister_exister
Nov 16 '18 at 17:18
use unwind segue. In VC 1 declare unwind segue on VC 3 create unwind segue and assigned id to segue and perform it.
– Junaid
Nov 16 '18 at 19:32
use unwind segue. In VC 1 declare unwind segue on VC 3 create unwind segue and assigned id to segue and perform it.
– Junaid
Nov 16 '18 at 19:32
@Junaid can you show how to do?
– Utku Dalmaz
Nov 16 '18 at 19:33
@Junaid can you show how to do?
– Utku Dalmaz
Nov 16 '18 at 19:33
OK i will show you
– Junaid
Nov 16 '18 at 19:35
OK i will show you
– Junaid
Nov 16 '18 at 19:35
Found a simple solution just call this method self.dismiss(animated: true, completion: nil)
– Junaid
Nov 16 '18 at 19:42
Found a simple solution just call this method self.dismiss(animated: true, completion: nil)
– Junaid
Nov 16 '18 at 19:42
|
show 1 more comment
2 Answers
2
active
oldest
votes
We need more details about View Controllers hierarchy and how the navigations is done exactly.
Note that unless the other view controller (that you want to show up after you pop current view controller) is not current yet on the hierarchy - there will be problems.
I advice to use a Coordinator Object (which is not a view controller, inherits from NSObject). Make it be the one that decides what view controller should popup and what to show next.
The coordinator needs a reference to App Delegate's window property, in order to set its rootViewController property as needed. All view controllers have to also delegate to the coordinator to notify it about Close / Add / Save events etc.
Watch this presentation https://vimeo.com/144116310 and note that this is a more advanced pattern then what you'll find in Apple's documentation. The idea is that View Controllers should not present other view controllers or know about other view controllers' existence at all... unless it's a Container View Controller, such as UINavigationController, UITabBarController, subclasses of those or custom ones.
add a comment |
First in VC1 Class declare this method
class VC1: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func unwindtoVC1(segue: UIStoryboardSegue) {
}
}
Then See Image to create unwind segue
after that in your VC3 class
class VC3: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func didCloseTap(_ sender: Any) {
self.performSegue(withIdentifier: "segueToVC1", sender: nil)
}
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53341221%2fpop-viewcontroller-to-another-viewcontroller-from-another-navigation-controller%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
We need more details about View Controllers hierarchy and how the navigations is done exactly.
Note that unless the other view controller (that you want to show up after you pop current view controller) is not current yet on the hierarchy - there will be problems.
I advice to use a Coordinator Object (which is not a view controller, inherits from NSObject). Make it be the one that decides what view controller should popup and what to show next.
The coordinator needs a reference to App Delegate's window property, in order to set its rootViewController property as needed. All view controllers have to also delegate to the coordinator to notify it about Close / Add / Save events etc.
Watch this presentation https://vimeo.com/144116310 and note that this is a more advanced pattern then what you'll find in Apple's documentation. The idea is that View Controllers should not present other view controllers or know about other view controllers' existence at all... unless it's a Container View Controller, such as UINavigationController, UITabBarController, subclasses of those or custom ones.
add a comment |
We need more details about View Controllers hierarchy and how the navigations is done exactly.
Note that unless the other view controller (that you want to show up after you pop current view controller) is not current yet on the hierarchy - there will be problems.
I advice to use a Coordinator Object (which is not a view controller, inherits from NSObject). Make it be the one that decides what view controller should popup and what to show next.
The coordinator needs a reference to App Delegate's window property, in order to set its rootViewController property as needed. All view controllers have to also delegate to the coordinator to notify it about Close / Add / Save events etc.
Watch this presentation https://vimeo.com/144116310 and note that this is a more advanced pattern then what you'll find in Apple's documentation. The idea is that View Controllers should not present other view controllers or know about other view controllers' existence at all... unless it's a Container View Controller, such as UINavigationController, UITabBarController, subclasses of those or custom ones.
add a comment |
We need more details about View Controllers hierarchy and how the navigations is done exactly.
Note that unless the other view controller (that you want to show up after you pop current view controller) is not current yet on the hierarchy - there will be problems.
I advice to use a Coordinator Object (which is not a view controller, inherits from NSObject). Make it be the one that decides what view controller should popup and what to show next.
The coordinator needs a reference to App Delegate's window property, in order to set its rootViewController property as needed. All view controllers have to also delegate to the coordinator to notify it about Close / Add / Save events etc.
Watch this presentation https://vimeo.com/144116310 and note that this is a more advanced pattern then what you'll find in Apple's documentation. The idea is that View Controllers should not present other view controllers or know about other view controllers' existence at all... unless it's a Container View Controller, such as UINavigationController, UITabBarController, subclasses of those or custom ones.
We need more details about View Controllers hierarchy and how the navigations is done exactly.
Note that unless the other view controller (that you want to show up after you pop current view controller) is not current yet on the hierarchy - there will be problems.
I advice to use a Coordinator Object (which is not a view controller, inherits from NSObject). Make it be the one that decides what view controller should popup and what to show next.
The coordinator needs a reference to App Delegate's window property, in order to set its rootViewController property as needed. All view controllers have to also delegate to the coordinator to notify it about Close / Add / Save events etc.
Watch this presentation https://vimeo.com/144116310 and note that this is a more advanced pattern then what you'll find in Apple's documentation. The idea is that View Controllers should not present other view controllers or know about other view controllers' existence at all... unless it's a Container View Controller, such as UINavigationController, UITabBarController, subclasses of those or custom ones.
answered Nov 16 '18 at 19:21
ppalancicappalancica
3,31341834
3,31341834
add a comment |
add a comment |
First in VC1 Class declare this method
class VC1: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func unwindtoVC1(segue: UIStoryboardSegue) {
}
}
Then See Image to create unwind segue
after that in your VC3 class
class VC3: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func didCloseTap(_ sender: Any) {
self.performSegue(withIdentifier: "segueToVC1", sender: nil)
}
}
add a comment |
First in VC1 Class declare this method
class VC1: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func unwindtoVC1(segue: UIStoryboardSegue) {
}
}
Then See Image to create unwind segue
after that in your VC3 class
class VC3: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func didCloseTap(_ sender: Any) {
self.performSegue(withIdentifier: "segueToVC1", sender: nil)
}
}
add a comment |
First in VC1 Class declare this method
class VC1: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func unwindtoVC1(segue: UIStoryboardSegue) {
}
}
Then See Image to create unwind segue
after that in your VC3 class
class VC3: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func didCloseTap(_ sender: Any) {
self.performSegue(withIdentifier: "segueToVC1", sender: nil)
}
}
First in VC1 Class declare this method
class VC1: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func unwindtoVC1(segue: UIStoryboardSegue) {
}
}
Then See Image to create unwind segue
after that in your VC3 class
class VC3: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func didCloseTap(_ sender: Any) {
self.performSegue(withIdentifier: "segueToVC1", sender: nil)
}
}
answered Nov 16 '18 at 20:02
JunaidJunaid
59110
59110
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53341221%2fpop-viewcontroller-to-another-viewcontroller-from-another-navigation-controller%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
you to pop to VC1 navigation controller not to VC1
– canister_exister
Nov 16 '18 at 17:18
use unwind segue. In VC 1 declare unwind segue on VC 3 create unwind segue and assigned id to segue and perform it.
– Junaid
Nov 16 '18 at 19:32
@Junaid can you show how to do?
– Utku Dalmaz
Nov 16 '18 at 19:33
OK i will show you
– Junaid
Nov 16 '18 at 19:35
Found a simple solution just call this method self.dismiss(animated: true, completion: nil)
– Junaid
Nov 16 '18 at 19:42