Git Product home page Git Product logo

nzcircularimageview's Introduction

#NZCircularImageView License MIT

NZCircularImageView

NZCircularImageView is a UIImageView extension. Its performs async download image and leaves with rounded edge.

It can be used, for example, to presenting pictures of user profiles.

Build Status Cocoapods Cocoapods

Requirements

NZCircularImageView works on iOS 5.0+ version and is compatible with ARC projects. It depends on the following Apple frameworks, which should already be included with most Xcode templates:

  • Foundation.framework
  • QuartzCore.framework
  • UIKit.framework

You will need LLVM 3.0 or later in order to build NZCircularImageView.

NZCircularImageView uses SDWebImage and UIActivityIndicator-for-SDWebImage to download async images.

Adding NZCircularImageView to your project

Cocoapods

CocoaPods is the recommended way to add NZCircularImageView to your project.

  • Add a pod entry for NZCircularImageView to your Podfile pod 'NZCircularImageView', '~> 0.0.2'
  • Install the pod(s) by running pod install.

Source files

Alternatively you can directly add source files to your project.

  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
  2. Open your project in Xcode, then drag and drop all files at NZCircularImageView folder onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.
  3. Install SDWebImage
  4. Install UIActivityIndicator-for-SDWebImage

Usage

The class overrides -(void)setFrame:, thus ensuring that every time an image is set, it will be presented in a rounded shape. This class also uses UIViewContentModeScaleAspectFill contentMode with the clipsToBounds flag so that the image resolution is not changed.

  • Setting at Storyboard to automatic rounded image

NZCircularImageView

  • Setting a rounded avatar image
circularImageView.image = [UIImage imageNamed:@"Default-Avatar"];
  • Async download image
// this method append parameters at url:
// - width: image view width
// - height: image view height
// - mode: crop (crop image from center)
[circularImageView setImageWithResizeURL:@"http://example.com/image.png"];
//
// ... with custom loading indicator
[circularImageView setImageWithResizeURL:kImageUrl
             usingActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
//
// ... with completion block
[circularImageView setImageWithResizeURL:kImageUrl
             usingActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite
                               completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
                                    NSLog(@"Download completed");
              }];

To enable the logs in debug/release mode, add #define NZDEBUG at *-Prefix.pch file in your project.

License

This code is distributed under the terms and conditions of the MIT license.

Change-log

A brief summary of each NZCircularImageView release can be found on the wiki.

nzcircularimageview's People

Stargazers

Mohamed EL Meseery avatar Ahmed Eid avatar

Watchers

Fred Chen avatar James Cloos 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.