开发者

How do I specify to only display the "Value" of my plist - Right now the whole path loads in my UITextfield

showDescriptionPath is being passed from the previous Tableview. The text shows up, but the entire path prints in the UITextField instead of just the value of "Description" in my plist.

NSString *DescriptionPath = [[NSBundle mainBundle] bundlePath];
NSString *DescriptionInfoPath = [DescriptionPath stringByAppendingPathComponent:showDescriptionInfo];
showDescription.text = [[NSStri开发者_C百科ng alloc] initWithFormat:@"%@",DescriptionInfoPath];


That's because you're not trying to load a value at all. The code you posted above will only show the path of what you're trying to load.

You can init a dictionary and get a value by using:

NSDictionary * myDict = [[NSDictionary alloc] initWithContentsOfFile:DescriptionInfoPath];
NSString * theValue = [myDict valueForKey:@"theKey"];
showDescription.text = theValue;
[myDict release];

Hope that helps

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜