2

Есть ли способ, чтобы переключить DocumentInteractionController на Titanium я не найти его в любом случаедокументов Взаимодействие контроллера на Titanium

я думаю, что это то, что мне нужно

- (UIDocumentInteractionController *) setupControllerWithURL: (NSURL) fileURL 
    usingDelegate: (id <UIDocumentInteractionControllerDelegate>) interactionDelegate { 

    UIDocumentInteractionController *interactionController = 
     [UIDocumentInteractionController interactionControllerWithURL: fileURL]; 
    interactionController.delegate = interactionDelegate; 

    return interactionController; 
} 

ответ

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(); 
0

Предпочитаю, что это вам поможет.

В этом блоге доступен исходный код для открытия документа в ios-documentviewer.

Appcelerator Blog

+0

Обратите внимание, что [ссылка только ответы не рекомендуется] (http://meta.stackoverflow.com/tags/link-only-answers/info), поэтому ответы должны быть конечной точкой искать решение (по сравнению с другой остановкой ссылок, которые со временем устаревают). Пожалуйста, подумайте о добавлении отдельного резюме здесь, сохранив ссылку в качестве ссылки. – kleopatra

+0

@ kleopatra: Спасибо за инструкцию :). –