All Projects → ahmetkgunay → CollageView

ahmetkgunay / CollageView

Licence: MIT License
Easy to use and fully customizable CollageView with multiple images inside.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to CollageView

jekyll-imgix
A plugin for integrating imgix into Jekyll sites
Stars: ✭ 49 (+145%)
Mutual labels:  images
mosaic-node-generator
Generate mosaic images in Node.
Stars: ✭ 25 (+25%)
Mutual labels:  collage
imagemin-power-cli
Optimize (compress) images with power using imagemin 💪
Stars: ✭ 13 (-35%)
Mutual labels:  images
coronavirus-mask-image-dataset
Image dataset from Instagram of people wearing medical masks, no mask, or a non-medical (DIY) mask
Stars: ✭ 57 (+185%)
Mutual labels:  images
hakyll-images
Hakyll utilities to work with images
Stars: ✭ 13 (-35%)
Mutual labels:  images
gettyimages-api nodejs
Getty Images API SDK for Node.js
Stars: ✭ 17 (-15%)
Mutual labels:  images
octodex
GitHub's Octocats.
Stars: ✭ 64 (+220%)
Mutual labels:  images
Website-Cloner
It allows you to download a website from the Internet to a local directory, building recursively all directories, getting HTML, images, and other files from the server to your computer.
Stars: ✭ 118 (+490%)
Mutual labels:  images
yamipa
Yet Another Minecraft Image Placing Addon
Stars: ✭ 19 (-5%)
Mutual labels:  images
kubectl-images
🕸 Show container images used in the cluster.
Stars: ✭ 153 (+665%)
Mutual labels:  images
diorama
An image layout algorithm
Stars: ✭ 17 (-15%)
Mutual labels:  images
kirby3-instagram
Kirby 3 Plugin to call Instagram (or any other) API Endpoints
Stars: ✭ 20 (+0%)
Mutual labels:  images
Bicubic-interpolation
Bicubic interpolation for images (Python)
Stars: ✭ 88 (+340%)
Mutual labels:  images
fl-image-resize
A library to quickly resize images with Azure Functions
Stars: ✭ 15 (-25%)
Mutual labels:  images
KnownMonikersExplorer
A Visual Studio extension
Stars: ✭ 21 (+5%)
Mutual labels:  images
high-quality-nix-content
GitHub repository containing highest quality Nix/NixOS content
Stars: ✭ 88 (+340%)
Mutual labels:  images
vue-inner-image-zoom
laurenashpole.github.io/vue-inner-image-zoom
Stars: ✭ 90 (+350%)
Mutual labels:  images
Liked-Saved-Image-Downloader
Save content you enjoy!
Stars: ✭ 80 (+300%)
Mutual labels:  images
hermitage-skeleton
Hermitage Skeleton
Stars: ✭ 16 (-20%)
Mutual labels:  images
markdown articles tool
Parse markdown article, download images and replace images URL's with local paths
Stars: ✭ 37 (+85%)
Mutual labels:  images

CollageView

Version License Platform Language Twitter: @ahmtgny

Custom View, collageView implementation with pure swift4.

This Library's aim is to make easily photo collage views.

Anim

Usage

Like any other customViews, can be used with changing your view's class name as "CollageView" or initialize in code.

  • Interface Builder

class ViewController: UIViewController {

    //Assume that you have images array, or you can fetch from remote
    let images = [#imageLiteral(resourceName: "amsterdam"), #imageLiteral(resourceName: "istanbul"), #imageLiteral(resourceName: "camera"), #imageLiteral(resourceName: "istanbul2"), #imageLiteral(resourceName: "mirror")];

    @IBOutlet weak var collageView: CollageView!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Set delegate to trigger click events on imageview's
        collageView.delegate    = self
        // Set datasource to fill your collageView with data
        collageView.dataSource  = self
    }

    deinit {
        collageView.delegate    = nil
        collageView.dataSource  = nil
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}
  • Initialize in Code
class ViewController: UIViewController {

    //Assume that you have images array, or you can fetch from remote
    let images = [#imageLiteral(resourceName: "amsterdam"), #imageLiteral(resourceName: "istanbul"), #imageLiteral(resourceName: "camera"), #imageLiteral(resourceName: "istanbul2"), #imageLiteral(resourceName: "mirror")];

    var collageView = CollageView(frame: .zero)

    override func viewDidLoad() {
        super.viewDidLoad()

        view.addSubview(collageView)

        // Set delegate to trigger click events on imageview's
        collageView.delegate    = self
        // Set datasource to fill your collageView with data
        collageView.dataSource  = self
    }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        // Example frame
        collageView.frame = view.bounds
    }

    deinit {
        collageView.delegate    = nil
        collageView.dataSource  = nil
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}

After that, fill required dataSource and optional delegate methods

extension ViewController: CollageViewDataSource {

    func collageViewNumberOfTotalItem(_ collageView: CollageView) -> Int {

        // total images count to show up
        return images.count
    }

    func collageViewNumberOfRowOrColoumn(_ collageView: CollageView) -> Int {

        // Sets number of total coloumn or row count of layout direction
        return 3
    }

    func collageViewLayoutDirection(_ collageView: CollageView) -> CollageViewLayoutDirection {

        // Sets the starting layout to fill images with
        // can be horizontol or vertical
        // if set to horizontal, first image rowIndex is (0, 0) and second one is (1, 0)
        // if set to vertical, first image rowIndex is (0, 0) and second one is (0, 1)

        return .horizontal
    }

    func collageView(_ collageView: CollageView, configure itemView: CollageItemImageView, at index: Int) {

        // MAGIC is in this code block
        // You can prepare your item here also,
        // You can fetch Images from Remote here!,
        // Customize UI for item, and etc..
        itemView.image = images[index]
        itemView.layer.borderWidth = 3
    }
}

extension ViewController: CollageViewDelegate {

    func collageView(_ collageView: CollageView, didSelect itemView: CollageItemImageView, at index: Int) {

        // Trigger click event of each image item
        let message = "didSelect at index:  \(index), rowIndex: \(String(describing: itemView.collageItem!.rowIndex))"
        print(message)
    }
}

Demo App Output

Installation

There are two ways to use CollageView in your project:

  • using CocoaPods
  • by cloning the project into your repository

Installation with CocoaPods

CocoaPods is a dependency manager for Swift and Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. See the Get Started section for more details.

Podfile

use_frameworks!
pod 'CollageView', '~> 1.0.4'

Author

Ahmet Kazım Günay, [email protected]

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].