English 中文(简体)
阅读优惠的价值
原标题:reading a value from preferences

我最近已经安装了安ppSettings包。 我的目标是把我的缺省观点装上,然后在称为“设定”的权利上添加一条航条带。 用户一旦压力环境,就会将他们带往我的环境,让他们选择他们想要的网站,然后用新车再次装上我的缺省观点。

我已经执行了我刚才描述的所有事情,但一旦甄选是在环境中进行的,而且用户会回头(为了回到默认观点而放弃环境)、坠机和我没有想法。 我的法典如下,如果任何人知道发生这种情况的原因,那将受到高度赞赏。 请注意,一旦我在坠毁之后再次运行,网站的负荷就根据它们在坠毁之前选择的环境正确无误。

P.S. 用户可点击选择的选项是:谷歌、 st流。

ERROR 信息: 因无一例外而终止任用 - [新情况:]:送交0x281c70的未经承认的遴选人

事先感谢你

- (IASKAppSettingsViewController*)appSettingsViewController {
    if (!appSettingsViewController) {
        appSettingsViewController = [[IASKAppSettingsViewController alloc] initWithNibName:@"IASKAppSettingsView" bundle:nil];
        appSettingsViewController.delegate = self;
    }

    return appSettingsViewController;
}

-(IBAction)selectSettings {
    UINavigationController *aNavController = [[UINavigationController alloc] initWithRootViewController:self.appSettingsViewController];
    //[viewController setShowCreditsFooter:NO];   // Uncomment to not display InAppSettingsKit credits for creators.
    // But we encourage you not to uncomment. Thank you!
    self.appSettingsViewController.showDoneButton = YES;
    [self presentModalViewController:aNavController animated:YES];
    [aNavController release];
}

-(NSDictionary *)intialDefaults {
    NSArray *keys = [[[NSArray alloc] initWithObjects:kPicture, nil] autorelease];  
    NSArray *values= [[[NSArray alloc] initWithObjects: @"none", nil] autorelease];
    return [[[NSDictionary alloc] initWithObjects: values forKeys: keys] autorelease];
} 

-(void)setValuesFromPreferences {
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults registerDefaults:[self intialDefaults]];
    NSString *picturePreference= [userDefaults stringForKey:kPicture];

    if([picturePreference isEqualToString:@"google"]) {             
        [self getUpcoming:@"http://www.google.ca"];
    } else 
    if ([picturePreference isEqualToString:@"stackoverflow"]) {
        [self getUpcoming:@"http://www.stackoverflow.com"];
    } else {
        [self getUpcoming:@"http://www.yahoo.com"];
    }
}

-(void)getUpcoming:(id) hello {
    NSURL *url= [NSURL URLWithString:hello];
    NSURLRequest *requestURL= [NSURLRequest requestWithURL:url];
    [web loadRequest:requestURL];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    web.hidden=NO;
    [spinner stopAnimating];
    [load_message dismissWithClickedButtonIndex:0 animated:TRUE];
    pic1.hidden=YES;
}

-(void) loadMethod {
    load_message = [[UIAlertView alloc] initWithTitle:@"Loading..." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:nil];

    spinner= [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    spinner.center = CGPointMake(135.0, 60.0);

    [load_message addSubview:spinner];
    [load_message show];
    [spinner startAnimating];
    [self performSelector:@selector(setValuesFromPreferences) withObject:nil afterDelay:0.0];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    UIBarButtonItem *settingButton= [[UIBarButtonItem alloc]
                               initWithTitle:@"Settings"
                               style:UIBarButtonItemStyleBordered
                               target:self
                               action:@selector(selectSettings)];

    self.navigationItem.rightBarButtonItem = settingButton;
    web.hidden=YES;
    pic1.hidden=NO;
}

- (void) viewDidAppear:(BOOL)animated {
    [self loadMethod];
}
最佳回答

你是否执行InAppSettingKit代表? 加上以上表格

- (void)settingsViewControllerDidEnd:(IASKAppSettingsViewController *)sender
{
    // dismiss the view here
    [self dismissModalViewControllerAnimated:YES];
    // do whatever you need to do
}
问题回答

暂无回答




相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签