Questions tagged [uikit-state-preservation]

The state preservation system in UIKit provides a simple but flexible infrastructure for preserving and restoring the state of your app’s view controllers and views.

37 questions
20
votes
2 answers

iOS state preservation and container views

I have a view controller in a storyboard that is using a container view. Both have restoration identifiers set. The parent is being saved and restored just fine. The child however is not. Neither -encodeRestorableStateWithCoder: or…
David Beck
  • 10,099
  • 5
  • 51
  • 88
11
votes
2 answers

iOS 6 - State Preservation and Restoration

I have implemented iOS 6 API for state saving, it works - after I quit the app and launch back in for some milliseconds the restored view controller fly in, but then it's replaced by the main view controller I display at launch. I'm setting every…
Devfly
  • 2,495
  • 5
  • 38
  • 56
10
votes
1 answer

How can viewControllerWithRestorationIdentifierPath:coder: find an existing instance?

The docs on viewControllerWithRestorationIdentifierPath:coder: say: Your implementation of this method should create (or find) the corresponding view controller object and return it... It is not always necessary to create a new view controller…
matt
  • 515,959
  • 87
  • 875
  • 1,141
9
votes
1 answer

Where do we find the "Restrospector" tool mention in WWDC 2012 Session 208?

WWDC 2012 Session 208 is about UIKit state preservation and restoration. Pretty much at the end the debugging tool "Restrospector" is mentioned. It should visualize the persisted state on disk. The state itself is persisted to the file "data.data"…
Klaas
  • 22,394
  • 11
  • 96
  • 107
8
votes
1 answer

State Restoration in Tab Bar and Navigation Controller App

Goal: I'm trying to restore state on a tab controller-based app (with navigation controllers on each tab). Problem: On relaunch, the selected tab seems to be restored as expected, but the navigation hierarchy inside said tab is not. Development: I…
Nicolas Miari
  • 16,006
  • 8
  • 81
  • 189
8
votes
3 answers

Why can't I encode an NSValue in an NSKeyedArchiver?

I was trying to encode an MKMapView center and span into an NSKeyedArchiver for state preservation. I found a couple of handy new MapKit NSValue additions, valueWithMKCoordinate: and valueWithMKCoordinate:. Trying to encode these into the keyed…
nevan king
  • 112,709
  • 45
  • 203
  • 241
8
votes
4 answers

UIKit state preservation not restoring scroll offset

I have an app that is using UIKit state preservation in iOS 6. I am able to save/restore the state of the view controllers, ie which tab is selected and navigation controller hierarchy, however I cannot get my table view to restore it's offset. I…
David Beck
  • 10,099
  • 5
  • 51
  • 88
7
votes
1 answer

why my iOS app restarts from first screen after coming back to foreground mode?

When in My iOS app which which is in the detail screen and I press home button which will result it in going to background mode. After inactivity of 7 around minutes, I relaunch it and it doesn't start from where I left it. It starts from the first…
7
votes
1 answer

Automated Testing of iOS 6 State Preservation and Restoration

I'm updating an app to use the new state preservation and restoration functionality in iOS 6. As far as I can tell the best guidance on testing this in apps involves doing it manually (e.g.…
6
votes
2 answers

UICollectionView state restoration: customizing scroll position

I am trying to find the best way to handle state restoration for a UICollectionView whose elements may move around. My goal is to make sure that the last viewed item in the collection view is still visible when restarting the app, even if the items…
5
votes
1 answer

State Preservation for View Controllers with Custom Delegates or Data Sources

I am attempting to use iOS 6+ (my app is 7.0+) State Preservation to preserve a view that is presented modally from another View Controller. As such it, has the typical modal view controller dismissal pattern: TNTLoginViewController.h…
5
votes
2 answers

iOS preserve state of UIWebView?

Is it possible to preserve the state of the UIWebView (e.g the current webpage, back/front list) in the current app launch? For example, if I dealloc a webview, and at some point in the future, I want to recreate it - is it possible to give it the…
Alex1987
  • 9,397
  • 14
  • 70
  • 92
3
votes
2 answers

How can I prevent SKAction sequence restarting after decoding?

My app is a SpriteKit game with application state preservation and restoration. When application state is preserved, most of the nodes in my current SKScene are encoded. When a node running an SKAction is encoded and decoded, the action will…
Karl Voskuil
  • 750
  • 6
  • 19
3
votes
1 answer

State preservation and restoration strategies with Core Data objects in a UIManagedDocument

I'm starting to try and add support for state preservation and restoration to my iOS app, which has a Core Data component to it that I access via a UIManagedDocument. I'm starting to add the restoration identifiers to my view controllers, and have…
3
votes
0 answers

custom container view controller state preservation

I need to create custom container viewcontroller with label and 2 states A and B(each state presented by child viewcontroller and swap each other). Both children viewcontrollers instantiates when parent container creates and currentViewController is…
Slav
  • 361
  • 2
  • 11
1
2 3