uidocumentinteractioncontroller
DESCRIPTION
TRANSCRIPT
iPhone SDK 勉強会
UIDocumentInteractionController
Quick Look Framework
2011年1月30日日曜日
iPhone SDK 勉強会
自己紹介
岸川克己http://kishikawakatsumi.com
Twitter@k_katsumi
24/7 twenty-four sevenhttp://d.hatena.ne.jp/KishikawaKatsumi/
2011年1月30日日曜日
iPhone SDK 勉強会
公開中のアプリケーション
•はてな touch
•LDR touch•テレビ番組表•LCD Clock•Subway Map
•MyWebClip•こころくろっく•英辞郎 on the WEB
•i-Radio•くるりんぱ性格診断
2011年1月30日日曜日
iPhone SDK 勉強会
http://github.com/kishikawakatsumi
•hatena-touch•ldr-touch•tv-listings•MapKit-Route-Directions•FlipCardNavigationView•PhotoFlipCardView
•DescriptionBuilder•TiledLayerView•UICCalendarPicker
2011年1月30日日曜日
iPhone SDK 勉強会
共著
2011年1月30日日曜日
iPhone SDK 勉強会
UIDocumentInteractionController
Quick Look Framework
2011年1月30日日曜日
iPhone SDK 勉強会
•ドキュメントのプレビューとオプションの表示•ファイルタイプのサポートの登録•ほかのアプリケーションからのファイルのオープン•Quick Lookプレビューの表示と印刷
2011年1月30日日曜日
iPhone SDK 勉強会
Open in "iBooks"
2011年1月30日日曜日
iPhone SDK 勉強会Interacting with Documents
2011年1月30日日曜日
iPhone SDK 勉強会
Documents
WWDC 2010 Session 106 - Understanding the Document Interaction Controller
iOSドキュメントインタラクションプログ ラミングトピックスhttp://developer.apple.com/jp/devcenter/ios/library/documentation/DocumentInteraction_TopicsForIOS.pdf
Uniform Type Identifiers Referencehttp://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/UTIRef/UTIRef.pdf
2011年1月30日日曜日
iPhone SDK 勉強会
Sample Code
DocInteractionhttp://developer.apple.com/library/ios/#samplecode/DocInteraction/Introduction/Intro.html
2011年1月30日日曜日
iPhone SDK 勉強会
DEMO
2011年1月30日日曜日
iPhone SDK 勉強会
UIDocumentInteractionControllerを
作成する
2011年1月30日日曜日
iPhone SDK 勉強会
+ interactionControllerWithURL:
UIDocumentInteractionController
2011年1月30日日曜日
iPhone SDK 勉強会
NSURL *URL*以下は自動的に設定される(明示的に設定してもいい)
NSString *name NSString *UTI
UIDocumentInteractionController
2011年1月30日日曜日
iPhone SDK 勉強会
UIを提供する
2011年1月30日日曜日
iPhone SDK 勉強会
*readonlyNSArray *icons
UIDocumentInteractionController
2011年1月30日日曜日
iPhone SDK 勉強会
2011年1月30日日曜日
iPhone SDK 勉強会
- (void)setupDocumentControllerWithURL:(NSURL *)url { self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url]; self.docInteractionController.delegate = self;}
2011年1月30日日曜日
iPhone SDK 勉強会NSURL *fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:documents[indexPath.row] ofType:nil]];
[self setupDocumentControllerWithURL:fileURL];
cell.textLabel.text = [[fileURL path] lastPathComponent];NSInteger iconCount = [docInteractionController.icons count];if (iconCount > 0){ cell.imageView.image = [docInteractionController.icons objectAtIndex:iconCount - 1];}
2011年1月30日日曜日
iPhone SDK 勉強会
プレビューを表示する
2011年1月30日日曜日
iPhone SDK 勉強会
•presentPreviewAnimated:•dismissPreviewAnimated:
UIDocumentInteractionControllerのプレビュー
Quick Look Framework
2011年1月30日日曜日
iPhone SDK 勉強会
[self.docInteractionController presentPreviewAnimated:YES];
#pragma mark -#pragma mark UIDocumentInteractionControllerDelegate
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)interactionController{ return self;}
2011年1月30日日曜日
iPhone SDK 勉強会
Quick Look Frameworkを使用してプレビューを表示する
2011年1月30日日曜日
iPhone SDK 勉強会QLPreviewController *previewController = [[QLPreviewController alloc] init];previewController.dataSource = self;previewController.delegate = self; previewController.currentPreviewItemIndex = indexPath.row;
[self presentModalViewController:previewController animated:YES];[previewController release];
2011年1月30日日曜日
iPhone SDK 勉強会#pragma mark -#pragma mark QLPreviewControllerDataSource
// Returns the number of items that the preview controller should preview- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)previewController{ NSInteger numToPreview = 0; NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow]; if (selectedIndexPath.section == 0) numToPreview = NUM_DOCS; else numToPreview = self.documentURLs.count; return numToPreview;}
2011年1月30日日曜日
iPhone SDK 勉強会// returns the item that the preview controller should preview- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex:(NSInteger)index{ NSURL *fileURL = nil; NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow]; if (selectedIndexPath.section == 0) { fileURL = [NSURL fileURLWithPath: [[NSBundle mainBundle]pathForResource:documents[index] ofType:nil]]; } else { fileURL = [self.documentURLs objectAtIndex:index]; } return fileURL;}
2011年1月30日日曜日
iPhone SDK 勉強会
Quick Look Frameworkを使用するメリット
•モーダル以外の表示方法や遷移のアニメーションをカスタマイズ可能•連続してファイルを切り替えて表示することができる
2011年1月30日日曜日
iPhone SDK 勉強会
Quick Look Frameworkでプレビュー可能なファイル
2011年1月30日日曜日
iPhone SDK 勉強会•iWork文書•Microsoft Office文書(Office 97以降)•Rich Text Format(RTF)文書•PDFファイル•画像•public.textタイプに準拠したUTI(Uniform Type Identifier)を持つテキストファイル(『Uniform Type Identifiers Reference』を参照)。•カンマ区切り(CSV)ファイル
2011年1月30日日曜日
iPhone SDK 勉強会
•presentPreviewAnimated:•dismissPreviewAnimated:
UIDocumentInteractionControllerのプレビュー
Quick Look Framework
2011年1月30日日曜日
iPhone SDK 勉強会
操作の選択肢を提示する
2011年1月30日日曜日
iPhone SDK 勉強会
•presentOptionsMenuFromRect: inView: animated:•presentOptionsMenuFromBarButtonItem: animated:•dismissMenuAnimated:
UIDocumentInteractionController
2011年1月30日日曜日
iPhone SDK 勉強会
Open in "iBooks"
2011年1月30日日曜日
iPhone SDK 勉強会
他のアプリで開く
2011年1月30日日曜日
iPhone SDK 勉強会
•presentOpenInMenuFromRect: inView: animated:•presentOpenInMenuFromBarButtonItem: animated:•dismissMenuAnimated:
UIDocumentInteractionController
2011年1月30日日曜日
iPhone SDK 勉強会Interacting with Documents
2011年1月30日日曜日
iPhone SDK 勉強会NSURL *fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:documents[indexPath.row] ofType:nil]];
[self setupDocumentControllerWithURL:fileURL];
cell.textLabel.text = [[fileURL path] lastPathComponent];NSInteger iconCount = [docInteractionController.icons count];if (iconCount > 0){ cell.imageView.image = [docInteractionController.icons objectAtIndex:iconCount - 1];}
2011年1月30日日曜日
iPhone SDK 勉強会
ファイルをアプリに関連付ける
2011年1月30日日曜日
iPhone SDK 勉強会
2011年1月30日日曜日
iPhone SDK 勉強会<plist version="1.0"><dict>! <key>CFBundleDocumentTypes</key>! <array>! ! <dict>! ! ! <key>CFBundleTypeName</key>! ! ! <string>Ika File Format</string>! ! ! <key>CFBundleTypeExtensions</key>! ! ! <array>! ! ! ! <string>ika</string>! ! ! </array>! ! ! <key>CFBundleTypeIconFiles</key>! ! ! <array>! ! ! ! <string>ika_twitter_01.gif</string>! ! ! ! <string>ika_twitter_13.gif</string>! ! ! </array>! ! ! <key>LSItemContentTypes</key>! ! ! <array>! ! ! ! <string>com.kishikawakatsumi.ika</string>! ! ! </array>! ! ! <key>LSHandlerRank</key>! ! ! <string>owner</string>! ! </dict>! ! <dict>! ! ! <key>CFBundleTypeName</key>
2011年1月30日日曜日
iPhone SDK 勉強会
<key>CFBundleTypeName</key><string>PDF File Format</string>
2011年1月30日日曜日
iPhone SDK 勉強会
<key>LSItemContentTypes</key><array> <string>com.adobe.pdf</string></array>
2011年1月30日日曜日
iPhone SDK 勉強会
<key>CFBundleTypeIconFiles</key><array> <string>ika_twitter_01.gif</string> <string>ika_twitter_13.gif</string></array>
2011年1月30日日曜日
iPhone SDK 勉強会
<key>LSHandlerRank</key><string>owner</string>
2011年1月30日日曜日
iPhone SDK 勉強会
拡張子を登録する
2011年1月30日日曜日
iPhone SDK 勉強会
2011年1月30日日曜日
iPhone SDK 勉強会! <key>UTExportedTypeDeclarations</key>! <array>! ! <dict>! ! ! <key>UTTypeDescription</key>! ! ! <string>Ika File Format</string>! ! ! <key>UTTypeIdentifier</key>! ! ! <string>com.kishikawakatsumi.ika</string>! ! ! <key>UTTypeTagSpecification</key>! ! ! <dict>! ! ! ! <key>public.filename-extension</key>! ! ! ! <string>ika</string>! ! ! </dict>! ! </dict>! </array>
2011年1月30日日曜日