Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9408] iOS: Titanium.UI.iPad.DocumentViewer should be available also for iPhone

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-06-27T23:45:52.000+0000
Affected Version/sn/a
Fix Version/sSprint 2012-13 API
ComponentsiOS
LabelsSupportTeam, api, qe-port, release-note, support
ReporterFederico Casali
AssigneeSabil Rahim
Created2012-06-05T17:31:08.000+0000
Updated2012-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

Additional notes

Customer ticket: http://support-admin.appcelerator.com/display/APP-773698

Comments

  1. Blain Hamon 2012-06-21

    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.
  2. Sabil Rahim 2012-06-22

    TESTING INSTRUCTION

    //Please provide a sample.pdf to the test
       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.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();
       
  3. Sabil Rahim 2012-06-22

    [PULL PENDING](https://github.com/appcelerator/titanium_mobile/pull/2461)

JSON Source