开发者

Settings Application Implementation - boolean values set to "no" by default

开发者 https://www.devze.com 2023-01-08 13:34 出处:网络
The question, by itself, implies that the DefaultValue property in my Root.plist file was set to \"no\".This is unfortunately not true.To verify what my problem is, I am trying to use a section of the

The question, by itself, implies that the DefaultValue property in my Root.plist file was set to "no". This is unfortunately not true. To verify what my problem is, I am trying to use a section of the iPhone's Settings application. I am using this to show/hide certain on-screen items. By default, the "shown" property was set to "on." Unfortunately, all of the on-screen items were hidden before the user went to the settings app, turned the options off, then turned them on again! Here is my code.


if ([prefs boolForKey:@"artwork_prefrence"] == YES)
        currentArtwork.hidden = NO;
    else if ([prefs boolForKey:@"artwork_prefrence"] == NO)
        currentArtwork.hidden = YES;

    if ([prefs boolForKey:@"title_prefrence"] == YES)
        currentSong.hidden = NO;
    else if ([prefs boolForKey:@"title_prefrence"] == NO)
        currentSong.hidden = YES;

    if ([prefs boolForKey:@"artist_prefrence"] == YES)
        currentArtist.hidden = NO;
    else if ([prefs boolForKey:@"artist_prefrence"] == NO)
        currentArtist.hidden = YES;
开发者_StackOverflow中文版
    if ([prefs boolForKey:@"next_prefrence"] == YES)
        nextbutton.hidden = NO;
    else if ([prefs boolForKey:@"next_prefrence"] == NO)
        nextbutton.hidden = YES;

    if ([prefs boolForKey:@"prev_prefrence"] == YES)
        prevbutton.hidden = NO;
    else if ([prefs boolForKey:@"prev_prefrence"] == NO)
        prevbutton.hidden = YES;

    if ([prefs boolForKey:@"progress_prefrence"] == YES)
        progressslider.hidden = NO;
    else if ([prefs boolForKey:@"progress_prefrence"] == NO)
        progressslider.hidden = YES;

Any and all help is appreciated. Thanks in advance!


You have to use registerDefaults in your initialize-method in your App Delegate.

0

精彩评论

暂无评论...
验证码 换一张
取 消