2
0

In-App Settings.

[ADDED]     Settings view to edit the settings while in the app.
This commit is contained in:
Maarten Billemont
2012-02-05 22:01:37 +01:00
parent 9b961ecac1
commit ad9d124a32
7 changed files with 324 additions and 33 deletions

View File

@@ -9,6 +9,7 @@
#import "OPAppDelegate.h"
#import "OPMainViewController.h"
#import "IASKSettingsReader.h"
@interface OPAppDelegate ()
@@ -117,6 +118,18 @@
[[UISegmentedControl appearance] setDividerImage:segmentSelectedUnselected forLeftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UISegmentedControl appearance] setDividerImage:segUnselectedSelected forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected barMetrics:UIBarMetricsDefault];*/
[[NSNotificationCenter defaultCenter] addObserverForName:kIASKAppSettingChanged object:nil queue:nil
usingBlock:^(NSNotification *note) {
if ([NSStringFromSelector(@selector(storeKeyPhrase))
isEqualToString:[note.object description]]) {
self.keyPhrase = self.keyPhrase;
[self loadKeyPhrase];
}
if ([NSStringFromSelector(@selector(forgetKeyPhrase))
isEqualToString:[note.object description]])
[self loadKeyPhrase];
}];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {

View File

@@ -9,8 +9,9 @@
#import "OPTypeViewController.h"
#import "OPElementEntity.h"
#import "OPSearchDelegate.h"
#import "IASKAppSettingsViewController.h"
@interface OPMainViewController : UIViewController <OPTypeDelegate, UITextFieldDelegate, UISearchBarDelegate, OPSearchResultsDelegate, UIWebViewDelegate>
@interface OPMainViewController : UIViewController <OPTypeDelegate, UITextFieldDelegate, UISearchBarDelegate, OPSearchResultsDelegate, UIWebViewDelegate, IASKSettingsDelegate>
@property (strong, nonatomic) OPElementEntity *activeElement;
@property (strong, nonatomic) IBOutlet OPSearchDelegate *searchResultsController;

View File

@@ -11,6 +11,7 @@
#import "OPContentViewController.h"
#import "OPElementGeneratedEntity.h"
#import "OPElementStoredEntity.h"
#import "IASKAppSettingsViewController.h"
#import <MobileCoreServices/MobileCoreServices.h>
@@ -75,9 +76,21 @@
[self updateAnimated:animated];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
self.searchTipContainer.hidden = YES;
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}
- (void)viewDidLoad {
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"ui_background"]];
// Put the search tip on the window so it's above the nav bar.
if (![self.searchTipContainer.superview isEqual:self.navigationController.navigationBar.superview]) {
@@ -88,15 +101,6 @@
self.searchTipContainer.frame = [self.searchTipContainer.window convertRect:frameInWindow
toView:self.searchTipContainer.superview];
}
}
- (void)viewDidLoad {
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"ui_background"]];
//self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo-bare.png"]];
self.navigationItem.titleView.frame = CGRectMake(0, 0, 50, 50);
self.navigationItem.titleView.center = self.navigationController.navigationBar.center;
self.navigationItem.titleView.contentMode = UIViewContentModeScaleAspectFit;
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillResignActiveNotification object:nil queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note) {
@@ -336,14 +340,15 @@
case 2:
[[OPAppDelegate get] showGuide];
break;
case 3:
[[UIApplication sharedApplication] openURL:
[NSURL URLWithString:[NSString stringWithFormat:@"prefs:root=Apps&path=%@",
[InfoPlist get].CFBundleDisplayName]]];
case 3: {
IASKAppSettingsViewController *settingsVC = [IASKAppSettingsViewController new];
settingsVC.delegate = self;
[self.navigationController pushViewController:settingsVC animated:YES];
break;
}
}
} cancelTitle:[PearlStrings get].commonButtonCancel destructiveTitle:nil
otherTitles:[self isHelpVisible]? @"Hide Help": @"Show Help", @"FAQ", @"Quick Start", @"Settings", nil];
otherTitles:[self isHelpVisible]? @"Hide Help": @"Show Help", @"FAQ", @"Tutorial", @"Settings", nil];
}
- (void)didSelectType:(OPElementType)type {
@@ -423,4 +428,10 @@
return YES;
}
- (void)settingsViewControllerDidEnd:(IASKAppSettingsViewController *)sender {
while ([self.navigationController.viewControllers containsObject:sender])
[self.navigationController popViewControllerAnimated:YES];
}
@end

View File

@@ -96,22 +96,6 @@
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Usability</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Show Quick Start</string>
<key>Key</key>
<string>showQuickStart</string>
<key>DefaultValue</key>
<true/>
</dict>
</array>
<key>StringsTable</key>
<string>Root</string>