+ All Categories
Home > Technology > UIDocumentInteractionController

UIDocumentInteractionController

Date post: 07-Nov-2014
Category:
Upload: katsumi-kishikawa
View: 7,536 times
Download: 0 times
Share this document with a friend
Description:
 
Popular Tags:
48
iPhone SDK 勉強会 UIDocumentInteractionController Quick Look Framework 2011130日日曜日
Transcript
Page 1: UIDocumentInteractionController

iPhone SDK 勉強会

UIDocumentInteractionController

Quick Look Framework

2011年1月30日日曜日

Page 3: UIDocumentInteractionController

iPhone SDK 勉強会

公開中のアプリケーション

•はてな touch

•LDR touch•テレビ番組表•LCD Clock•Subway Map

•MyWebClip•こころくろっく•英辞郎 on the WEB

•i-Radio•くるりんぱ性格診断

2011年1月30日日曜日

Page 4: UIDocumentInteractionController

iPhone SDK 勉強会

http://github.com/kishikawakatsumi

•hatena-touch•ldr-touch•tv-listings•MapKit-Route-Directions•FlipCardNavigationView•PhotoFlipCardView

•DescriptionBuilder•TiledLayerView•UICCalendarPicker

2011年1月30日日曜日

Page 5: UIDocumentInteractionController

iPhone SDK 勉強会

共著

2011年1月30日日曜日

Page 6: UIDocumentInteractionController

iPhone SDK 勉強会

UIDocumentInteractionController

Quick Look Framework

2011年1月30日日曜日

Page 7: UIDocumentInteractionController

iPhone SDK 勉強会

•ドキュメントのプレビューとオプションの表示•ファイルタイプのサポートの登録•ほかのアプリケーションからのファイルのオープン•Quick Lookプレビューの表示と印刷

2011年1月30日日曜日

Page 8: UIDocumentInteractionController

iPhone SDK 勉強会

Open in "iBooks"

2011年1月30日日曜日

Page 9: UIDocumentInteractionController

iPhone SDK 勉強会Interacting with Documents

2011年1月30日日曜日

Page 10: UIDocumentInteractionController

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日日曜日

Page 11: UIDocumentInteractionController

iPhone SDK 勉強会

Sample Code

DocInteractionhttp://developer.apple.com/library/ios/#samplecode/DocInteraction/Introduction/Intro.html

2011年1月30日日曜日

Page 12: UIDocumentInteractionController

iPhone SDK 勉強会

DEMO

2011年1月30日日曜日

Page 13: UIDocumentInteractionController

iPhone SDK 勉強会

UIDocumentInteractionControllerを

作成する

2011年1月30日日曜日

Page 14: UIDocumentInteractionController

iPhone SDK 勉強会

+ interactionControllerWithURL:

UIDocumentInteractionController

2011年1月30日日曜日

Page 15: UIDocumentInteractionController

iPhone SDK 勉強会

NSURL *URL*以下は自動的に設定される(明示的に設定してもいい)

NSString *name NSString *UTI

UIDocumentInteractionController

2011年1月30日日曜日

Page 16: UIDocumentInteractionController

iPhone SDK 勉強会

UIを提供する

2011年1月30日日曜日

Page 17: UIDocumentInteractionController

iPhone SDK 勉強会

*readonlyNSArray *icons

UIDocumentInteractionController

2011年1月30日日曜日

Page 18: UIDocumentInteractionController

iPhone SDK 勉強会

2011年1月30日日曜日

Page 19: UIDocumentInteractionController

iPhone SDK 勉強会

- (void)setupDocumentControllerWithURL:(NSURL *)url { self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url]; self.docInteractionController.delegate = self;}

2011年1月30日日曜日

Page 20: UIDocumentInteractionController

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日日曜日

Page 21: UIDocumentInteractionController

iPhone SDK 勉強会

プレビューを表示する

2011年1月30日日曜日

Page 22: UIDocumentInteractionController

iPhone SDK 勉強会

•presentPreviewAnimated:•dismissPreviewAnimated:

UIDocumentInteractionControllerのプレビュー

Quick Look Framework

2011年1月30日日曜日

Page 23: UIDocumentInteractionController

iPhone SDK 勉強会

[self.docInteractionController presentPreviewAnimated:YES];

#pragma mark -#pragma mark UIDocumentInteractionControllerDelegate

- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)interactionController{ return self;}

2011年1月30日日曜日

Page 24: UIDocumentInteractionController

iPhone SDK 勉強会

Quick Look Frameworkを使用してプレビューを表示する

2011年1月30日日曜日

Page 25: UIDocumentInteractionController

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日日曜日

Page 26: UIDocumentInteractionController

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日日曜日

Page 27: UIDocumentInteractionController

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日日曜日

Page 28: UIDocumentInteractionController

iPhone SDK 勉強会

Quick Look Frameworkを使用するメリット

•モーダル以外の表示方法や遷移のアニメーションをカスタマイズ可能•連続してファイルを切り替えて表示することができる

2011年1月30日日曜日

Page 29: UIDocumentInteractionController

iPhone SDK 勉強会

Quick Look Frameworkでプレビュー可能なファイル

2011年1月30日日曜日

Page 30: UIDocumentInteractionController

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日日曜日

Page 31: UIDocumentInteractionController

iPhone SDK 勉強会

•presentPreviewAnimated:•dismissPreviewAnimated:

UIDocumentInteractionControllerのプレビュー

Quick Look Framework

2011年1月30日日曜日

Page 32: UIDocumentInteractionController

iPhone SDK 勉強会

操作の選択肢を提示する

2011年1月30日日曜日

Page 33: UIDocumentInteractionController

iPhone SDK 勉強会

•presentOptionsMenuFromRect: inView: animated:•presentOptionsMenuFromBarButtonItem: animated:•dismissMenuAnimated:

UIDocumentInteractionController

2011年1月30日日曜日

Page 34: UIDocumentInteractionController

iPhone SDK 勉強会

Open in "iBooks"

2011年1月30日日曜日

Page 35: UIDocumentInteractionController

iPhone SDK 勉強会

他のアプリで開く

2011年1月30日日曜日

Page 36: UIDocumentInteractionController

iPhone SDK 勉強会

•presentOpenInMenuFromRect: inView: animated:•presentOpenInMenuFromBarButtonItem: animated:•dismissMenuAnimated:

UIDocumentInteractionController

2011年1月30日日曜日

Page 37: UIDocumentInteractionController

iPhone SDK 勉強会Interacting with Documents

2011年1月30日日曜日

Page 38: UIDocumentInteractionController

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日日曜日

Page 39: UIDocumentInteractionController

iPhone SDK 勉強会

ファイルをアプリに関連付ける

2011年1月30日日曜日

Page 40: UIDocumentInteractionController

iPhone SDK 勉強会

2011年1月30日日曜日

Page 41: UIDocumentInteractionController

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日日曜日

Page 42: UIDocumentInteractionController

iPhone SDK 勉強会

<key>CFBundleTypeName</key><string>PDF File Format</string>

2011年1月30日日曜日

Page 43: UIDocumentInteractionController

iPhone SDK 勉強会

<key>LSItemContentTypes</key><array> <string>com.adobe.pdf</string></array>

2011年1月30日日曜日

Page 44: UIDocumentInteractionController

iPhone SDK 勉強会

<key>CFBundleTypeIconFiles</key><array> <string>ika_twitter_01.gif</string> <string>ika_twitter_13.gif</string></array>

2011年1月30日日曜日

Page 45: UIDocumentInteractionController

iPhone SDK 勉強会

<key>LSHandlerRank</key><string>owner</string>

2011年1月30日日曜日

Page 46: UIDocumentInteractionController

iPhone SDK 勉強会

拡張子を登録する

2011年1月30日日曜日

Page 47: UIDocumentInteractionController

iPhone SDK 勉強会

2011年1月30日日曜日

Page 48: UIDocumentInteractionController

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日日曜日


Recommended