It is possible to use an existing ViewController w

2019-02-06 05:55发布

I use the method performSegueWithIdentifier:sender: to open a new ViewController from a storyboard-file programmatically. This works like a charm.

But on every time when this method is being called, a new ViewController would be created. Is it possible to use the existing ViewController, if it exista? I don't find anything about this issue (apple-doc, Stack Overflow, ...).

The Problem is: On the created ViewController the user set some form-Elements and if the ViewController would be called again, the form-elements has the initial settings :(

Any help would be appreciated.

Edit: I appreciate the many responses. Meanwhile, I'm not familiar with the project and can not check your answers.

7条回答
兄弟一词,经得起流年.
2楼-- · 2019-02-06 06:25

You would need to make the Viewcontroller into a singleton class.

查看更多
登录 后发表回答