CalStoreIcon Class Reference

Inherits from CalStoreObject : NSObject
Declared in CalStoreIcon.h

Overview

Model object for the Icons being used in the Calendar Store.

To get the object for this icon, use the image property. If the image property is nil, use fetchImageWithCompletionHandler: .

Caching

It’s recommended to use this class' image and fetchImageWithCompletionHandler: methods, instead of doing a network request yourself. The CalStoreIcon class will automatically perform caching and cache validation of the image.

Image

  image

The UIImage for this icon. If nil, use fetchImageWithCompletionHandler: to fetch the image asynchronously.

@property (nonatomic, readonly) UIImage *image

Discussion

Caching is done automatically for this property.

Declared In

CalStoreIcon.h

Fetching the Image

  fetchingImage

YES when the image for this icon is currently being fetched.

@property (nonatomic, readonly, getter=isFetchingImage) BOOL fetchingImage

Declared In

CalStoreIcon.h

– fetchImageWithCompletionHandler:

Starts an async fetch operation for the image for this icon. When completed successfully, the image property will return the image. To cancel an ongoing fetch operation, use cancelImageFetch.

- (void)fetchImageWithCompletionHandler:(CalStoreImageCompletionHandler)completionHandler

Parameters

completionHandler

The block to call when the fetch operation finished (either successful or not). Will be called on the main queue.

Discussion

Only one fetch operation can be undergoing for the same CalStoreIcon object. Starting another fetch operation while one is in progress will raise an exception.

Declared In

CalStoreIcon.h

– cancelImageFetch

Cancels an ongoing image fetch operation.

- (void)cancelImageFetch

Declared In

CalStoreIcon.h

URL Info

  url

The URL where the image for this icon is located. This url will be unique for each different version of the same image. E.g., if a pixel in an image changes, the url will be different. Thus, it is possible to cache images based on their url.

@property (nonatomic, readonly) NSURL *url

Declared In

CalStoreIcon.h