Created
June 28, 2013 23:19
-
-
Save egomez99/5888886 to your computer and use it in GitHub Desktop.
iOS createDocumentViewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Titanium.UI.createWindow({ | |
title : 'Window', | |
backgroundColor : '#fff', | |
className : 'navBarColor', | |
translucent : false | |
}); | |
var scrollingView = Ti.UI.createScrollView({ | |
top : 0, | |
left : 0, | |
right : 0, | |
bottom : 0 | |
}); | |
win.add(scrollingView); | |
var docButton = Titanium.UI.createButton({ | |
top : 10, | |
right : 10, | |
height : 30, | |
width : 200, | |
style : Titanium.UI.iPhone.SystemButtonStyle.BORDERED, | |
title : 'View Document' | |
}); | |
scrollingView.add(docButton); | |
var displayProposal = function() { | |
var downloadDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, ''); | |
Ti.API.info('downloadDir: ' + downloadDir); | |
var downloadFile = Titanium.Filesystem.getFile(downloadDir.nativePath, 'doc.pdf'); | |
Ti.API.info('downloadFile: ' + downloadFile); | |
var downloadFilePath = downloadFile.nativePath; | |
Ti.API.info('downloadFilePath: ' + downloadFilePath); | |
var docViewer = Titanium.UI.iOS.createDocumentViewer({ | |
url : 'doc.pdf' | |
}); | |
docViewer.show(); | |
setTimeout(function() { | |
docViewer.hide(); | |
}, 5000); | |
} | |
docButton.addEventListener('click', function(e) { | |
displayProposal(); | |
}); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment