The iOS framework that grows only as fast as its documentation
Snapshot Rotation

Classes

class  NISnapshotRotation
 The NISnapshotRotation class provides support for implementing snapshot-based rotations on views. More...
 
class  NITableViewSnapshotRotation
 The NITableViewSnapshotRotation class implements the fixedInsetsForSnapshotRotation: delegate method and forwards all other delegate methods along. More...
 
protocol  <NISnapshotRotationDelegate>
 The methods declared by the NISnapshotRotation protocol allow the adopting delegate to respond to messages from the NISnapshotRotation class and thus implement snapshot rotations. More...
 

Functions

UIImage * NISnapshotOfView (UIView *view)
 
UIImageView * NISnapshotViewOfView (UIView *view)
 
UIImage * NISnapshotOfViewWithTransparency (UIView *view)
 
UIImageView * NISnapshotViewOfViewWithTransparency (UIView *view)
 

Overview

An object designed to easily implement snapshot rotation.

Snapshot rotation involves taking two screenshots of a UIView: the "before" and the "after" state of the rotation. These two images are then cross-faded during the rotation, creating an animation that minimizes visual artifacts that would otherwise be noticed when rotation occurs.

This feature will only function on iOS 6.0 and higher. On older iOS versions the view will rotate just as it always has.

This functionality has been adopted from WWDC 2012 session 240 "Polishing Your Interface Rotations".

Function Documentation

NISnapshotOfView

Returns an opaque UIImage snapshot of the given view.

UIImage* NISnapshotOfView:(UIView *)view;
Discussion

This method takes into account the offset of scrollable views and captures whatever is currently in the frame of the view.

Parameters
viewA snapshot will be taken of this view.
Returns
A UIImage with the snapshot of view.

NISnapshotViewOfView

Returns a UIImageView with an image snapshot of the given view.

UIImageView* NISnapshotViewOfView:(UIView *)view;
Discussion

The frame of the returned view is set to match the frame of view.

Parameters
viewA snapshot will be taken of this view.
Returns
A UIImageView with the snapshot of view and matching frame.

NISnapshotOfViewWithTransparency

Returns a UIImage snapshot of the given view with transparency.

UIImage* NISnapshotOfViewWithTransparency:(UIView *)view;
Discussion

This method takes into account the offset of scrollable views and captures whatever is currently in the frame of the view.

Parameters
viewA snapshot will be taken of this view.
Returns
A UIImage with the snapshot of view.

NISnapshotViewOfViewWithTransparency

Returns a UIImageView with an image snapshot with transparency of the given view.

UIImageView* NISnapshotViewOfViewWithTransparency:(UIView *)view;
Discussion

The frame of the returned view is set to match the frame of view.

Parameters
viewA snapshot will be taken of this view.
Returns
A UIImageView with the snapshot of view and matching frame.