Latest 0.2.9
Homepage https://github.com/botirjon/PhotoViewerController
License MIT
Platforms ios 8.0
Frameworks UIKit
Authors

CI Status
Version
License
Platform

Example

To be able to use the library, you need to first install the pod. Then import the PhotoViewerController into your project:

import PhotoViewerController

Then initliaze a PhotoViewerController object, set its delegate, initial item index. To get the desired behaviour set its modalPresentationStyle to .overFullScreen.

Example:

let photoViewer = PhotoViewerController()
photoViewer?.delegate = self
photoViewer?.initialItemIndex = 3
photoViewer?.modalPresentationStyle = .overFullScreen

You should also implement its delegate functions:

Example:

extension ViewController: PhotoViewerControllerDelegate{

    func numberOfItems(in photoViewer: PhotoViewerController) -> Int {
        // provide the number of items to display.
    }

    func numberOfActions(in photoViewer: PhotoViewerController, forItemAt index: Int) -> Int {
        // provide the number of actions for an item diplayed at index in photoViewer.
    }

    func photoViewer(_ photoViewer: PhotoViewerController, imageView: UIImageView, at index: Int) {
        // customize the imageView provided for an item to display at index in photoViewer.
    }

    func photoViewer(_ photoViewer: PhotoViewerController, topBarLeftItemsAt index: Int) -> [UIBarButtonItem] {
        // provide an array of left top bar items for the the item to display at index.
    }

    func photoViewer(_ photoViewer: PhotoViewerController, topBarRightItemsAt index: Int) -> [UIBarButtonItem] {
        // provide an array of right top bar items for the the item to display at index.
    }

    func photoViewer(_ photoViewer: PhotoViewerController, actionBarButton button: UIButton, at position: Int, forItemAt index: Int) {
        // customize the provided action button at position for an item to display at index in photoViewer.
    }

    func photoViewer(_ photoViewer: PhotoViewerController, titleForItemAt index: Int) -> String {
        // provide a title for an item to display at index in photoViewer.
    }

    func photoViewer(_ photoViewer: PhotoViewerController, captionForItemAt index: Int) -> String {
        // provide a caption text for an item to display at index in photoViewer.
    }
}

After this you are all set to present the photoViewer:

self.present(photoViewer!, animated: true, completion: nil)

Requirements

Installation

PhotoViewerController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'PhotoViewerController'

Author

Botirjon Nasridinov, [email protected]

License

PhotoViewerController is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "PhotoViewerController",
    "version": "0.2.9",
    "summary": "A photo viewer controller for viewing photos.",
    "description": "It can be used to view a sequence of photos. Its PhotoViewerControllerDelegate should be conformed by the client.",
    "homepage": "https://github.com/botirjon/PhotoViewerController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "[email protected]": "[email protected]"
    },
    "source": {
        "git": "https://github.com/botirjon/PhotoViewerController.git",
        "tag": "0.2.9"
    },
    "platforms": {
        "ios": "8.0"
    },
    "swift_version": "3.0",
    "source_files": "PhotoViewerController/Classes/**/*",
    "resources": "PhotoViewerController/Classes/*.xib",
    "resource_bundles": {
        "PhotoViewerController": [
            "PhotoViewerController/**/*.xib"
        ]
    },
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This