2012-03-06 6 views
1

iBooksで書籍を開くにはどうすればよいですか?私は作品次のコードを、試してみましたが、ファイルを開くアプリケーションを選択するように求める:iBooksでファイルを開く方法

self.docController = [UIDocumentInteractionController alloc]; 

//leaves only the file name 
NSString *bookFile = @"my-book.pdf"; 

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectory = [paths objectAtIndex: 0]; 

NSString* filePath = [documentsDirectory stringByAppendingPathComponent: bookFile]; 

// Using the Book path 
self.docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:filePath]]; 

// setting the delegate 
_docController.delegate = self; 

// open the menu only if we find a valid application that can 
// open the file 
BOOL isValid = [self.docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES]; 

私はそれがこのためにユーザーを求めることなく、iBooksの上で直接開くようにしたいです。

ヒント?

答えて

関連する問題