Click here to support Nimbus development and make a donation at www.pledgie.com !
An iOS framework whose growth is bounded by O(documentation).

Overview

The view and protocols used to display a network image.

Classes

class  NINetworkImageView
 A network-enabled image view that consumes minimal amounts of memory. More...
protocol  <NINetworkImageViewDelegate>
 The image view delegate used to inform of state changes. More...

Enumerations

enum  NINetworkImageViewScaleOptions

Enumeration Type Documentation

Flags for modifying the way cropping is handled when scaling images to fit or fill.

By default the network image view will behave in the following way for these content modes:

  • UIViewContentModeScaleAspectFit: Leaves unfilled space as transparent.
  • UIViewContentModeScaleAspectFill: Crops any excess pixels.

The resulting image size will exactly match the display size.

You can modify this behavior using the following two flags which should be set using binary operators.

   NINetworkImageViewScaleToFitCropsRemainder
   The final image size will be shrunk to fit the image such that there is no transparency.

   NINetworkImageViewScaleToFillLeavesRemainder
   The final image size will be grown to include the excess pixels.
 

Examples

The following examples use this image:

clouds500x375.jpeg
Dimensions: 500x375

Default settings with UIViewContentModeScaleAspectFit

Result image (display size 100x100)

clouds100x100-fit.png
Fit image with default settings leaves transparent pixels. Size: 100x100.

Example code

  imageView.scaleOptions = NINetworkImageViewScaleToFitLeavesExcessAndScaleToFillCropsExcess;

  [imageView setPathToNetworkImage: @"http://farm2.static.flickr.com/1165/644335254_4b8a712be5.jpg"
                    forDisplaySize: CGSizeMake(100, 100)
                       contentMode: UIViewContentModeScaleAspectFit];

       source image size: 500x375  [aspect ratio: 1.3333]
            display size: 100x100  [aspect ratio: 1]
       result image size: 100x100  [aspect ratio: 1] (transparency on the left and right edges)
          image blt size: 100x75   [aspect ratio: 1.3333]

Default settings with UIViewContentModeScaleAspectFill

Result image (display size 100x100)

clouds100x100-fill.png
Fill image with default settings chops excess pixels. Size: 100x100.

Example code

  [imageView setPathToNetworkImage: @"http://farm2.static.flickr.com/1165/644335254_4b8a712be5.jpg"
                    forDisplaySize: CGSizeMake(100, 100)
                       contentMode: UIViewContentModeScaleAspectFill];

       source image size: 500x375  [aspect ratio: 1.3333]
            display size: 100x100  [aspect ratio: 1]
       result image size: 100x100  [aspect ratio: 1]
          image blt size: 133x100  [aspect ratio: 1.3333]

NINetworkImageViewScaleToFitCropsExcess with UIViewContentModeScaleAspectFit

Result image (display size 100x100)

clouds100x100-fit-cropped.png
Fit image with NINetworkImageViewScaleToFitCropsExcess crops the transparency. Size: 100x75.

Example code

  // Turn on NINetworkImageViewScaleToFitCropsExcess
  imageView.scaleOptions |= NINetworkImageViewScaleToFitCropsExcess;

  [imageView setPathToNetworkImage: @"http://farm2.static.flickr.com/1165/644335254_4b8a712be5.jpg"
                    forDisplaySize: CGSizeMake(100, 100)
                       contentMode: UIViewContentModeScaleAspectFill];

       source image size: 500x375  [aspect ratio: 1.3333]
            display size: 100x100  [aspect ratio: 1]
       result image size: 100x75   [aspect ratio: 1.3333]
          image blt size: 100x75   [aspect ratio: 1.3333]

NINetworkImageViewScaleToFillLeavesExcess with UIViewContentModeScaleAspectFill

Result image (display size 100x100)

clouds100x100-fill-excess.png
Fill image with NINetworkImageViewScaleToFillLeavesExcess leaves the excess. Size: 133x100.

Example code

  // Turn on NINetworkImageViewScaleToFillLeavesExcess
  imageView.scaleOptions |= NINetworkImageViewScaleToFillLeavesExcess;

  [imageView setPathToNetworkImage: @"http://farm2.static.flickr.com/1165/644335254_4b8a712be5.jpg"
                    forDisplaySize: CGSizeMake(100, 100)
                       contentMode: UIViewContentModeScaleAspectFill];

       source image size: 500x375  [aspect ratio: 1.3333]
            display size: 100x100  [aspect ratio: 1]
       result image size: 133x100  [aspect ratio: 1.3333]
          image blt size: 133x100  [aspect ratio: 1.3333]

Definition at line 41 of file NINetworkImageView.h.

Generated for Nimbus by doxygen 1.7.4-20110629