문제

I want to be able to change the DefaultValue of one of a UITableView cell in the Settings.bundle. I mainly want to put this...

userEmail = [defaults objectForKey:@"username"];

...into the plist.

I am doing this because I want my app to display the user's email in the settings so that they know what account they are using.

Here is part of the plist data that I want changed.

<dict>
            <key>IASKTextAlignment</key>
            <string>IASKUITextAlignmentRight</string>
            <key>DefaultValue</key>
            <string>EMAIL</string>
            <key>Key</key>
            <string>email</string>
            <key>Title</key>
            <string>Email</string>
            <key>Type</key>
            <string>PSTitleValueSpecifier</string>
        </dict>

How would I do this? Thanks in advance.

도움이 되었습니까?

해결책

You can't dynamically change the plist in the Settings.bundle because it belongs to the read-only (as far as sandboxing goes) app bundle.

What you probably want to do is to modify the current value using [[NSUserDefaults standardUserDefaults] setObject:@"the username" forKey:@"username"] in your -application:didFinishLaunchingWithOptions: or somewhere else in your startup process.

Then the change will be reflected in IASK and the system settings.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top