简体   繁体   中英

iOS 7 - Maintain view controller instance in Storyboard segue

I have an interactive custom view controller transition based on a storyboard segue (push).

The target view controller takes some time to be loaded as it contains a table with a lot of data; moreover when I leave this vc and come back, I need the table to maintain its content offset and not to start each time from the first row.

In order to achieve these two points I need the target vc to be a kind of singleton, and not to be deallocated/reallocated every time.

Any suggestion?

Thanks, DAN

Don't use a segue -- they always instantiate new view controllers. Create a property for the destination view controller in the controller that initiates the transition, and only instantiate it the first time you go to it. Push the new controller in code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM