[TIMOB-9408] iOS: Titanium.UI.iPad.DocumentViewer should be available also for iPhone
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2012-06-27T23:45:52.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Sprint 2012-13 API |
| Components | iOS |
| Labels | SupportTeam, api, qe-port, release-note, support |
| Reporter | Federico Casali |
| Assignee | Sabil Rahim |
| Created | 2012-06-05T17:31:08.000+0000 |
| Updated | 2012-08-08T13:10:52.000+0000 |
Description
Titanium.UI.iPad.DocumentViewer object (http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.UI.iPad.DocumentViewer) it's available only for iPad.
This is the sample code available for iPad on the documentation:
Titanium.UI.setBackgroundColor('#000');
//creating the window
var win1 = Titanium.UI.createWindow({
title:'win 1',
backgroundColor:'#fff'
});
//add window - navigation bar
var modalWin = Ti.UI.createWindow();
//nav bar
var navmodal = Ti.UI.iPhone.createNavigationGroup({
window:modalWin
});
win1.add(navmodal);
//button for the nav bar
var b2t = Titanium.UI.createButton({
title:'Launch'
});
modalWin.RightNavButton = b2t;
//button for the window
var b1t = Titanium.UI.createButton({
title:'Launch',
height:40,
width:200,
top:270
});
win1.add(b1t);
//Setting up the documentviewer
z = Ti.UI.iPad.createDocumentViewer({url:'Example.pdf'});
//documentviewer with animation set on and a quicklook view poping up next to a view
b1t.addEventListener('click', function(){z.show({animated:false,view:b2t});});
//documentviewer with animation set off
b2t.addEventListener('click', function(){z.show();});
win1.open();
Customer needs it also for iPhone; Ti.Ui.iOS.createDocumentViewer() should be available
Options: 1: Simplest version: Strip the iPad check (since it works fine on iPhone). 2: Simplest version, corrected: Strip the check, move to iOS namespace. 3: Fastest version: Make simple module clone that doesn't check. 4: Long term: There is a lot of overlap of documentViewer and Android intents. We might want to deprecate iPad.documentViewer, find a common ground, and implement that as a cross-platform solution.
TESTING INSTRUCTION
//Please provide a sample.pdf to the testTitanium.UI.setBackgroundColor('#000'); //creating the window var win1 = Titanium.UI.createWindow({ title:'win 1', backgroundColor:'#fff' }); //add window - navigation bar var modalWin = Ti.UI.createWindow(); //nav bar var navmodal = Ti.UI.iPhone.createNavigationGroup({ window:modalWin }); win1.add(navmodal); //button for the nav bar var b2t = Titanium.UI.createButton({ title:'Launch' }); modalWin.RightNavButton = b2t; //button for the window var b1t = Titanium.UI.createButton({ title:'Launch', height:40, width:200, top:270 }); win1.add(b1t); //Setting up the documentviewer z = Ti.UI.iOS.createDocumentViewer({url:'sample.pdf'}); //documentviewer with animation set on and a quicklook view poping up next to a view b1t.addEventListener('click', function(){z.show({animated:false,view:b2t});}); //documentviewer with animation set off b2t.addEventListener('click', function(){z.show();}); win1.open();[PULL PENDING](https://github.com/appcelerator/titanium_mobile/pull/2461)