Question

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.

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top