Coder Social home page Coder Social logo

jndisrupter / jnmultipleimages Goto Github PK

View Code? Open in Web Editor NEW
7.0 4.0 5.0 3.11 MB

Multiple images view

License: MIT License

Ruby 5.19% Swift 93.26% Objective-C 1.56%
multiple-imageview stacked-images newsfeed-images post-images cocoapods xcode aspectfill count-label image swift

jnmultipleimages's Introduction

JNMultipleImages

Build Status Version License Platform

JNMultipleImages can be used to display multiple images in single view, it can be used in a newsfeed or posts. A single post can contain up to 4 displayed images, while showing a number with the remaining images if they are more than 4.

Preview

Requirements

  • iOS 11.0+ / macOS 12.3+
  • Xcode 14.0+
  • Swift 5.7+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate JNMultipleImages into your Xcode project using CocoaPods, specify it in your Podfile:

use_frameworks!

target '<Your Target Name>' do
pod 'JNMultipleImages'
end

Then, run the following command:

$ pod install

Usage

To add JNMultipleImages in interface builder:

  1. Put some UIView and change the class to "JNMultipleImages"

  2. Add refrence for it in the view controller.

  3. Change Attributes:

  • You can change count label attributes by accessing it directly from the JNMultipleImages reference.
  • delegate : this delegate confirm to JNMultipleImagesViewDelegate.
  1. Call setup method:

Setup with JNImage array

setup(images: [JNImage], countLabelPosition: JNMultipleImagesCountLabelPosition = JNMultipleImagesCountLabelPosition.lastItem, placeHolderImage: UIImage? = nil, itemsMargin : CGFloat = 2.0, style: JNMultipleImagesView.style = .collection, cornerRadius: CGFloat = 0)

Setup with array of any which might be Url String or UIImage

func setup(images: [Any], countLabelPosition: JNMultipleImagesCountLabelPosition = JNMultipleImagesCountLabelPosition.lastItem, placeHolderImage: UIImage? = nil, itemsMargin: CGFloat = 2.0, style: JNMultipleImagesView.style = .collection, cornerRadius: CGFloat = 0)
parameters
  • images : The images array to load.
  • countLabelPosition : The position for the count label (Fill view or fill last item).
  • placeHolderImage : The placeholder image to use for failed images.
  • itemsMargin : The margin between items.
  • style : The style of the view, it can be collection or a stack(horizental).
  • cornerRadius : corner radius for images.

The library will adjust the UIImageViews content mode automatically like the follows :

  • If the image dimensions is smaller than the image view dimensions then the content mode is aspectFill
  • If image width and height ratio less than the image view width and height ration then the content mode is aspectFill
  • If the image is landscape and the image height is less than the image view height then the content mode is topRight
  • Other than this it is aspectFit.

Authors

Jayel Zaghmoutt & Mohammad Nabulsi

License

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

jnmultipleimages's People

Contributors

jayelzaghmoutt avatar mohammadnabulsi avatar yara-abuhijleh1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jnmultipleimages's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.