如何從我的iPhone導入* .pdf所有PDF到我的應用程序就像添加音樂文件一樣。 http://developer.apple.com/library/ios/#samplecode/AddMusic/Introduction/Intro.html。預先感謝。對iphone dev.New,真的很感謝任何幫助。導入* .pdf到我的應用程序iphone
NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
NSFileManager *mgr = [[NSFileManager alloc] init];
NSArray *allFiles = [mgr contentsOfDirectoryAtPath:bundlePath error:NULL];
for (NSString *fileName in allFiles)
{
if ([[fileName pathExtension] isEqualToString:@"pdf"])
{
NSString *fullFilePath = [bundlePath stringByAppendingPathComponent:fileName];
// fullFilePath now contains the path to your pdf file
// DoSomethingWithFile(fullFilePath);
NSLog(@"file: %@",fullFilePath);
}
}
NSURL *url = [[NSBundle mainBundle] URLForResource:@"" withExtension: @"pdf"];
NSLog(@"File: %@",url);
[你嘗試過什麼?](http://whathaveyoutried.com/) – rckoenes
從您的代碼似乎這個PDF文件已經存在於你的應用程序包和所有你想知道的是如何抓住它? –
是上面的代碼是爲了這個,但我想看到從iPhone的所有pdf的如何改變或我需要什麼路徑使用? –