mirror of
https://github.com/samsonjs/5by5Browser.git
synced 2026-04-27 15:07:39 +00:00
remember the scroll position of each show
This commit is contained in:
parent
c7df2b8aa8
commit
8479513027
2 changed files with 14 additions and 2 deletions
Binary file not shown.
|
|
@ -12,13 +12,14 @@
|
||||||
#import "NSDate+relative.h"
|
#import "NSDate+relative.h"
|
||||||
|
|
||||||
@interface ShowViewController ()
|
@interface ShowViewController ()
|
||||||
|
@property (nonatomic, retain) NSMutableDictionary *indexPaths;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation ShowViewController
|
@implementation ShowViewController
|
||||||
|
|
||||||
@synthesize detailViewController = _detailViewController;
|
@synthesize detailViewController = _detailViewController;
|
||||||
@synthesize show = _show;
|
@synthesize show = _show;
|
||||||
|
@synthesize indexPaths = _indexPaths;
|
||||||
|
|
||||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||||||
{
|
{
|
||||||
|
|
@ -26,6 +27,7 @@
|
||||||
if (self) {
|
if (self) {
|
||||||
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
||||||
self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);
|
self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);
|
||||||
|
self.indexPaths = [NSMutableDictionary dictionary];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
|
@ -39,10 +41,20 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) viewWillDisappear: (BOOL)animated
|
||||||
|
{
|
||||||
|
[super viewWillDisappear: animated];
|
||||||
|
[self.indexPaths setObject: [[self.tableView indexPathsForVisibleRows] objectAtIndex: 0] forKey: self.show.name];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) configureView
|
- (void) configureView
|
||||||
{
|
{
|
||||||
self.title = self.show.name;
|
self.title = self.show.name;
|
||||||
[self.tableView scrollToRowAtIndexPath: [NSIndexPath indexPathForRow: 0 inSection: 0] atScrollPosition: UITableViewScrollPositionTop animated: NO];
|
NSIndexPath *indexPath = [self.indexPaths objectForKey: self.show.name];
|
||||||
|
if (!indexPath) {
|
||||||
|
indexPath = [NSIndexPath indexPathForRow: 0 inSection: 0];
|
||||||
|
}
|
||||||
|
[self.tableView scrollToRowAtIndexPath: indexPath atScrollPosition: UITableViewScrollPositionTop animated: NO];
|
||||||
[self.tableView reloadData];
|
[self.tableView reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue