objective c - Set Title String to Settings Bundle iOS -
i need localize setting screen text dynamically based on iphone setting language/user preferred language. in scenario, localized text fetching server. storing text in database , showing on screen. setting screen should localized based on user preferred language/device language. tried access title string of item in root.plist. returns value need title. how can access/change title of item.
for eg:
{ defaultvalue = 1; key = "enabled_preference"; title = "keep me logged in"; type = pstoggleswitchspecifier; } [[nsuserdefaults standarduserdefaults]valueforkey:@"enabled_preference"];
which return value 1 need title "keep me logged in" needs changed.
i need "title" localized (ie) instead of using .lproj file, have set of localized strings in dictionary. need set title value dictionary.
how can accomplish this.
thanks
here way can values , keys.
this might you, keys , traverse key looking for
all values:
nslog(@"%@", [[[nsuserdefaults standarduserdefaults] dictionaryrepresentation] allvalues]);
all keys:
nslog(@"%@", [[[nsuserdefaults standarduserdefaults] dictionaryrepresentation] allkeys]);
all keys , values:
nslog(@"%@", [[nsuserdefaults standarduserdefaults] dictionaryrepresentation]);
using for:
nsarray *keys = [[[nsuserdefaults standarduserdefaults] dictionaryrepresentation] allkeys]; for(nsstring* key in keys){ // code here nslog(@"value: %@ forkey: %@",[[nsuserdefaults standarduserdefaults] valueforkey:key],key); }
Comments
Post a Comment