Access Child.plist from Settings.bundle in iPhone App - How?

I am having a problem accessing Settings.bundle.

Let me explain exactly what I am doing.

  • Any new project template from a file (for iPhone OS) is the preferred view based on.
  • Now right-click your project / resource group.
  • Select Add / New File
  • Under iPhone OS - resource - Settings package.
  • Name it strictly "Settings.bundle"

Now very important steps.

  • Expand Settings.bundle in your project.
  • Click on Root.plist
  • In the editor - expand preference specifiers
  • Delete paragraph 2, paragraph 3, paragraph 4
  • Select item 1 and copy and run it.
  • Change element 2 '(copy of paragraph 1)
  • Set PSChildPaneSpecifier as Type (item'2)
  • .
  • ( 2).
  • = "" String = "FontSettings"

" " & ; FontSettings.plist

Ok. .

  • , Settings.bundle/en.lproj( , plist settings.bundle.
  • / - Mac OS x - →
  • FontSettings.plist

, settings.bundle .

  • .
  • Settings.bundle
  • , .
  • FontSettings.plist , .

, FontSettings.plist

  • Root.plist settings.bundle.
  • , PreferenceSpecifiers FontSettings.plist
  • FontSettings.plist - , .

.

  • . ( .)
  • .
  • .

, , .

, , .

Root.plist,

[[NSUserDefaults standardUserDefaults] stringForKey:@"fName"]

.

: " - ?"

NSString *str=[[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"];
NSString *path=[str stringByAppendingPathComponent:@"FontSettings.plist"];
NSDictionary *dFor=[NSDictionary dictionaryWithContentsOfFile:path];

: " , - iPhone - .

Child.plist? ( ).

+3
1

, . .

, PSToggleSwitchSpecifier FontSettings.plist Key isBold,

[[NSUserDefaults standardUserDefaults] boolForKey:@"isBold"]
+5

Source: https://habr.com/ru/post/1734004/


All Articles