Skip to content

andydrizen/UIViewRecorder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Record and export a view hierarchy to PNG or JPEG frames for flip book style animations (as used in WatchKit).

Installation

Simply add this class into your project.

Usage

In your Swift code

Create an instance of Recorder and set the view that you wish to record:

let recorder = Recorder()
recorder.view = activityIndicator

When you are ready to start recording, simply:

recorder.start()

and when you are finished:

recorder.stop()

In your Objective-C code

Before you start, make sure your UIViewRecorder code has been properly integrated in your Objective-C project. Refer to official Apple guide Swift and Objective-C in the Same Project section Importing Swift into Objective-C.

Create an instance of Recorder and set the view that you wish to record:

Recorder *myRecorder = [[Recorder alloc] init];
myRecorder.view = activityIndicator;

When you are ready to start recording, simply:

[myRecorder start];

and when you are finished:

[myRecorder stop];

Output

The console will output some useful information such as:

  • Location of the files
  • Duration of the recording
  • Number of frames

You can specify the output path by setting the path property of the recorder. Also, if you would rather have JPGs, set the outputJPG property of the recorder to true.

About

Record and export a view hierarchy to PNG or JPEG frames for flip book style animations (as used in WatchKit).

Resources

License

Stars

Watchers

Forks

Packages

No packages published