Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple UI Configuration for INSPhotosViewController and INSPhotosOverlayView #77

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

blinover
Copy link

Hi

I add UI configuration file for INSPhotosViewController.

Now you can specify:

  • backgroundColor
  • activityIndicatorColor
  • navigationTitleTextColor
  • shadowStartColor
  • shadowEndColor
  • shadowHidden
  • rightBarButtonHidden
  • leftBarButtonHidden

Code sample:

func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
    let cell = collectionView.cellForItemAtIndexPath(indexPath) as! ExampleCollectionViewCell
    let currentPhoto = photos[indexPath.row]
    
    let configuration = INSConfiguration()
    configuration.backgroundColor = .white
    configuration.activityIndicatorColor = .blue
    configuration.shadowHidden = true
    configuration.rightBarButtonHidden = true
    configuration.leftBarButtonHidden = true
    configuration.navigationTitleTextColor = .green
    
    let galleryPreview = INSPhotosViewController<INSPhoto>(photos: photos, initialPhoto: currentPhoto, referenceView: cell, configuration: configuration)

    galleryPreview.referenceViewForPhotoWhenDismissingHandler = { [weak self] photo in
        if let index = self?.photos.indexOf({$0 === photo}) {
            let indexPath = NSIndexPath(forItem: index, inSection: 0)
            return collectionView.cellForItemAtIndexPath(indexPath) as? ExampleCollectionViewCell
        }
        return nil
    }
    presentViewController(galleryPreview, animated: true, completion: nil)
}

Also i added this sample to README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants