【发布时间】:2011-07-18 08:19:37
【问题描述】:
这里是新手(问题可能很明显),但经过许多小时试图弄清楚这一点后,我已经到了需要寻求帮助的地步......
基本上,我要做的就是从 .plist 中填充的数组中解析一个字符串。此字符串是本地 URL。它非常适用于外部 URL,但无论我为本地 URL 尝试了什么,我得到的都是什么 - 甚至没有找到一个 URL(我撒谎 - 这确实发生过一次,但再也不会被复制)。
我们将不胜感激任何和所有的帮助!
我在 DetailViewController 中有这段代码:
NSString *attractionURL = [detailItem description];
NSURL *url = [NSURL URLWithString:attractionURL];
[wikiView loadRequest:[NSURLRequest requestWithURL:url]];
并且这个代码在一个popOver(RootViewController)中:
- (void)viewDidLoad {
[super viewDidLoad];
self.clearsSelectionOnViewWillAppear = NO;
self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);
NSBundle *bundle = [NSBundle mainBundle];
NSString *path = [bundle pathForResource:@"recipes"
ofType:@"plist"];
attractions = [[NSArray alloc] initWithContentsOfFile:path];
self.title = @"Recipes";
使用 .plist 文件中的 URL:
<array>
<array>
<string>Sirloin</string>
<string>http://Resources/iPad/index.html</string>
</array>
<array>
<string>Chasseur</string>
<string>http://www.jamesmartinsfood.com</string>
</array>
</array>
</plist>
就像我说的,外部 URL 工作正常,本地只是不做蹲...
干杯!
【问题讨论】:
标签: xcode ios ipad ios4 uiwebview