有没有办法在Titanium上切换DocumentInteractionController 我没有以任何方式找到它
我认为这就是我需要的
- (UIDocumentInteractionController *) setupControllerWithURL: (NSURL) fileURL
usingDelegate: (id <UIDocumentInteractionControllerDelegate>) interactionDelegate {
UIDocumentInteractionController *interactionController =
[UIDocumentInteractionController interactionControllerWithURL: fileURL];
interactionController.delegate = interactionDelegate;
return interactionController;
}
答案 0 :(得分:2)
您正在寻找Ti.UI.iOS.createDocumentViewer()
。该API使用了UIDocumentInteractionController
。
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
win.open();
// Download a PDF.
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'casestudy_bracket.pdf'),
client = Ti.Network.createHTTPClient({
onload: function() {
// Open a doc viewer.
var docViewer = Ti.UI.iOS.createDocumentViewer({
url: file.nativePath
});
docViewer.show({ animated: true });
},
onerror: function() {
alert('Well, shoot.')
}
});
client.open('GET', 'http://www.appcelerator.com.s3.amazonaws.com/pdf/casestudy_bracket.pdf');
client.file = file;
client.send();
答案 1 :(得分:0)