To run the example project, clone the repo, and run pod install
from the Example directory first.
Swift 3.0+
Xcode 8.0+
To install it, simply add the following line to your Podfile:
pod 'SRInstaImageView'
or add SRInstaImageView.swift file into your project directory.
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.
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
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.
SRInstaImageView is available under the MIT license. See the LICENSE file for more info.