Commit 7faf7912 authored by Carola Nitz's avatar Carola Nitz Committed by Felix Paul Kühne

persist state of viewpreference in playlistController

parent beaf19a6
......@@ -34,7 +34,7 @@
/* prefs keys */
static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutorial?";
static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
@implementation EmptyLibraryView
- (IBAction)learnMore:(id)sender
......@@ -82,11 +82,12 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults registerDefaults:@{kDisplayedFirstSteps : [NSNumber numberWithBool:NO]}];
[defaults registerDefaults:@{kUsingTableViewToShowData : [NSNumber numberWithBool:UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone]}];
}
- (void)loadView
{
_usingTableViewToShowData = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone;
_usingTableViewToShowData = [[NSUserDefaults standardUserDefaults] boolForKey:kUsingTableViewToShowData];;
[self setupContentViewWithContentInset:NO];
_libraryMode = VLCLibraryModeAllFiles;
......@@ -1137,6 +1138,8 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
- (void)toggleDisplayedView:(UIBarButtonItem *)button
{
_usingTableViewToShowData = !_usingTableViewToShowData;
[[NSUserDefaults standardUserDefaults] setBool:_usingTableViewToShowData forKey:kUsingTableViewToShowData];
[[NSUserDefaults standardUserDefaults] synchronize];
UIImage *newButtonImage = [UIImage imageNamed: _usingTableViewToShowData ? @"collectionViewIcon" : @"tableViewIcon"];
[button setImage:newButtonImage];
[self setupContentViewWithContentInset:YES];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment