NZCircularImageView 0.0.5

NZCircularImageView 0.0.5

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Bruno Tortato Furtado.



  • By
  • Bruno Tortato Furtado

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 Analytics

Requirements

NZCircularImageView works on iOS 6.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

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 placeholder image
[self.imageView setImageWithResizeURL:kImageUrl
                     placeholderImage:[UIImage imageNamed:@"Sample"]
          usingActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];

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.

To-do Items