Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexito4/amppreviewcontroller
AMPPreviewController is a subclass of QLPreviewController that allows you to preview remote documents.
https://github.com/alexito4/amppreviewcontroller
Last synced: 4 days ago
JSON representation
AMPPreviewController is a subclass of QLPreviewController that allows you to preview remote documents.
- Host: GitHub
- URL: https://github.com/alexito4/amppreviewcontroller
- Owner: alexito4
- License: mit
- Created: 2014-05-27T07:15:06.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-11-06T14:23:05.000Z (about 5 years ago)
- Last Synced: 2024-10-31T16:12:46.656Z (12 days ago)
- Language: Objective-C
- Size: 176 KB
- Stars: 25
- Watchers: 5
- Forks: 22
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# AMPPreviewController
[![Version](http://cocoapod-badges.herokuapp.com/v/AMPPreviewController/badge.png)](http://cocoadocs.org/docsets/AMPPreviewController)
[![Platform](http://cocoapod-badges.herokuapp.com/p/AMPPreviewController/badge.png)](http://cocoadocs.org/docsets/AMPPreviewController)AMPPreviewController is a subclass of QLPreviewController that allows you to preview remote documents.
This class is designed to work with only one document at a time.
Also you can use a NSURL directly! Without the need of creating a QLPreviewItem conforming object.
So the developer doesn't need to deal with dataSource methods, just instantiate and present ;)## Usage
### With a remote URL
Just open a remote url:
NSURL *remoteURL = ...
AMPPreviewController *pc = [[AMPPreviewController alloc]
initWithRemoteFile:remoteURL];
[self presentViewController:pc animated:YES completion:nil];You can also execute a block when the download starts or ends:
[pc setStartDownloadBlock:^(){
...
}];
[pc setFinishDownloadBlock:^(NSError *error){
...
}];### With a local path
You can also load a local file. This is the same as using the QLPreviewController but more simple if you just want to present a **single file**.
NSURL *localPath = ...
AMPPreviewController *pc = [[AMPPreviewController alloc] initWithFilePath:localPath];
[self presentViewController:pc animated:YES completion:nil];### With a preview item
MyItem *item = ...
AMPPreviewController *pc = [[AMPPreviewController alloc] initWithPreviewItem:item];
[self presentViewController:pc animated:YES completion:nil];The *item* must conform to the `QLPreviewItem` protocol.
Additionally it can also conform to `AMPPreviewItem` wich adds the required `remoteUrl` method.
It will be the same as using the `initWithRemoteFile:` method but with your own object.## Installation
AMPPreviewController is available through [CocoaPods](http://cocoapods.org), to install
it simply add the following line to your Podfile:pod "AMPPreviewController"
## Author
Alejandro Martinez, [email protected]
## License
AMPPreviewController is available under the MIT license. See the LICENSE file for more info.