Skip to content

shamshiranees/SRInstaImageView

Repository files navigation

SRInstaImageView

CI Status Version License Platform

ScreenShot

ScreenShot ScreenShot

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Swift 3.0+
Xcode 8.0+

Installation

To install it, simply add the following line to your Podfile:

pod 'SRInstaImageView'

or add SRInstaImageView.swift file into your project directory.

Usage

SRInstaImageView is a subclass of UIImageView which popup a larger imageView on long press and removes it on release(as in instagram). To use SRInstaImageView change your imageView class to SRInstaImageView.

If your using in CollectionView

Change the class of your image view inside collectionView cell to SRInstaImageView.Then inside cellForItemAt indexPath

//Pass the image to ImageView
cell.photoImageView.image = UIImage(named: "\(indexPath.row-8)")

//You should pass the collectionView and the indexPath.
//Add these 2 line of code inside your cellForItemAt indexPath.
cell.photoImageView.collectionView = collectionView
cell.photoImageView.indexPathOFCell = indexPath

If your using in TableView

Change the class of your image view inside tableView cell to SRInstaImageView.Then inside cellForRowAt indexPath

//Pass the image to ImageView
cell.photoImageView.image = UIImage(named: "\(indexPath.row-8)")

//You should pass the tableView and the indexPath.
//Add these 2 line of code inside your cellForRowAt indexPath.
cell.photoImageView.tableView = tableView
cell.photoImageView.indexPathOFCell = indexPath

Having any confusion please download the project and run the Example.

Author

shamshir.anees@gmail.com

License

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