Code Monkey home page Code Monkey logo

jngroupavatarimageview's Introduction

JNGroupAvatarImageView

Version License Platform

JNGroupAvatarImageView is used to show group or single avatar image with the option to show initials, it can show 4 images at most.

Screenshots

Requirements

  • iOS 9.0+ / macOS 10.10+
  • Xcode 9.0+
  • Swift 4+

Installation

CocoaPods

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

$ gem install cocoapods

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

use_frameworks!

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

Then, run the following command:

$ pod install

Usage

To add JNGroupAvatarImageView in interface builder:

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

  2. Add refrence for it in the view controller.

  3. Implement JNGroupAvatar In you class like the following:

 class User : JNGroupAvatar {

     /**
       Get display name which will be used for the initials.
     - Returns: The display name for the avatar
     */
    func getGroupAvatarDisplayName() -> String {
       return ""
    }
    
    /**
       Get Avatar image url which will be used as avatar url
     - Returns: The image url
     */
    func getGroupAvatarImageUrl() -> String {
        return ""
    }
    
     /**
       Get Avatar image which will be used as avatar
     - Returns: The image 
     */
    func getGroupAvatarImage() -> UIImage {
        return UIImage()
    }
 }
  1. Call setup method with the following parameters:
 func setup(avatars : [JNGroupAvatar] , imagesLayoutDirection : ImagesLayoutDirection , avatarsMargin : CGFloat , separatorColor : UIColor, placeHolderImage : UIImage! , showInitails : Bool , initialsFont : UIFont , initialTextColor : UIColor)
  • avatars : Array fo JNGroupAvatar which will be used to draw .
  • imagesLayoutDirection : The image layout direction to use (right to left or left to right).
  • avatarsMargin : The margin between avatars (separator with or height).
  • separatorColor : The separator color to use.
  • placeHolderImage : The placeholder to use if the image failed to load.
  • showInitails : Show initials if the image failed to load or not, if false then set placeholder image.
  • initialsFont : The font to use for the initials.
  • initialTextColor : The text color to use for the initials.

The libarary will automaticly adjust initials label insets if the view is circle.

Authors

Jayel Zaghmoutt & Mohammad Nabulsi

License

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

jngroupavatarimageview's People

Contributors

ali-hamad avatar jayelzaghmoutt avatar mohammadnabulsi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

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.