Git Product home page Git Product logo

macachedimageview's Introduction

MACachedImageView

Overview

MACachedImageView is a UIImageView for displaying images on demand from the web. It's Spiced up with a caching functionality and a fancy load progress indicator. Developed with iOS 6 in mind, but probably working with older iOS releases.

Screenshot

Installation

CocoaPods

The easiest way to install MACachedImageView is using CocoaPods. Add the following dependency to your Podfile and run the pod install command via command line:

pod 'MACachedImageView', '~> 1.1.3'

Manual

If you'd like to install without CocoaPods, clone this repository and copy the following files from the MACachedImageView/ subfolder into your project:

  • MACachedImageView.h
  • MACachedImageView.m

Further you have to add two dependent libraries manually to your project:

Usage

MACachedImageView *cachedImageView = [MACachedImageView alloc] initWithFrame:CGRectMake(0,0,100,100)];
NSURL *url = [NSURL URLWithString:@"http://my.fancy.images.com/image.jpg"];

// Show an image by using the cache, if already available:
[cachedImageView displayImageFromURL:url];

// Show an image and force to refresh the cache:
[cachedImageView displayImageFromURL:url forceRefreshingCache:YES];

// Show a "local" UIImage:
UIImage *image = [UIImage imageNamed:@"image.jpg"];
[cachedImageView displayImage:image];

Customization

The view is customizable using direct property assignments or the appearance object:

MACachedImageView *appearance = [MACachedImageView appearance];

// Showing an image if no image is loaded yet or during loading an image:
appearance.placeholderImage = [UIImage imageNamed:@"..."];

// Use the placeholderImageContentMode property to decide how the placeholder
// image should be placed when shown.
appearance.placeholderImageContentMode = UIViewContentModeCenter;

// When displaying a loaded image, this content mode is used to show it properly.
appearance.imageContentMode = UIViewContentModeScaleAspectFill;

// The color of the download progress indicator.
appearance.progressIndicatorColor = [UIColor whiteColor];

// Set the stroke width of the MACircleProgressIndicator explicitly.
// progressIndicatorStrokeWidthRatio will be ignored.
//appearance.progressIndicatorStrokeWidth = 1.0;

// Set a ratio between the MACircleProgressIndicators size and the stroke width.
// progressIndicatorStrokeWidth will be ignored.
//appearance.progressIndicatorStrokeWidthRatio = 0.15; // default ratio, just for information :)

Demonstration App

Clone this repository and run pod install on the command line to fetch all dependencies. Open the resulting workspace file. Run the the regarding build schema to start the demo app in the iPhone or iPad simulator.

macachedimageview's People

Contributors

swissmanu avatar yichizhang avatar achappell avatar marknorgren avatar

Stargazers

JT5D avatar  avatar Anthony Persaud avatar DJ Tarazona avatar mayulu avatar Jonathan Dalrymple avatar Marc Pomar avatar  avatar Vinh Nguyen avatar Richard Venneman avatar Bob Edmonston avatar Adam Walz avatar Luis Hernandez avatar Peter Goldstein avatar Sebas Barrios avatar Alberto Jerez avatar Weiran Zhang avatar Yan Li avatar Bill Burgess avatar Michael Weibel avatar  avatar Romain Briche avatar Simon Fortelny avatar Parker Wightman avatar

Watchers

 avatar mayulu avatar  avatar

macachedimageview's Issues

display image in MACachedImageView without using cache

Hi,
I use MACachedImageView to download images from the net but in some cases, I actually do have the image in my application. In that case, I don't want to use any caching and just display the image in the MACachedImageView. How can I do that?

I tried using the placeholderImage property:

cell.cachedImageView.placeholderImage = image;

but this will not work. At least not all the time. I think it this happens when the MACachedImageView was already used to display a cached image (the cell is reused and so is the cell.cachedImageView

cheers

XCode IB does not see the MACachedImageView class

Hi,
I installed MACachedImageView using CocoaPods. I can instantiate a MACachedImageView in code fine but when I want to say to the Interface Builder that the class of a UIImageView is a MACachedImageView, it does not work

Screen Shot 2013-02-19 at 7 34 45 PM

what did I do wrong?

cheers

AFNetworking Dependancy Issue

[!] Unable to satisfy the following requirements:

  • AFNetworking (~> 3.1) required by Podfile
  • AFNetworking (= 3.1.0) required by Podfile.lock
  • AFNetworking (~> 1.1.0) required by MACachedImageView (1.0.0)

if i use your latest version 1.1.2, its required AFNetworking (2.0)
Kindly remove that dependancy or use latest AFNetworking Version.

Thanks

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.