You cannot use NSUserDefaults to save entire views, but you can save options that help determine where the bookmark should be set.
For example, if you use an alphabetic character by page number, you can save the page in NSUserDefaults when the user leaves the view controller.
Example:
[[NSUserDefaults standardUserDefaults] setInteger:23 forKey:@"bookMarkPage"]; [[NSUserDefaults standardUserDefaults] synchronize];
When the user returns to the view controller, you can check if there is a bookmark:
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"bookMarkPage"] != nil) { int pageNumber = [[NSUserDefaults standardUserDefaults] objectForKey:@"bookMarkPage"]; [self setBookmarkForPage:pageNumber]; }
Possible way to build bookmarks:
- (void) setBookmarkForPage:(Int)pageNumber {
You can use any parameters necessary to determine the placement of the book's character. When a user initially places a bookmark, what parameters do you use to figure out where to place the bookmark? Try using the same logic when the user first places a bookmark.
source share