PAGImageView Class Reference

Inherits from UIImageView
Declared in PAGImageView.h

+ MaxDiskSize

[Deprecated] Returns the size limit of the disk cache in bytes.

+ (NSUInteger)MaxDiskSize

Declared In

PAGImageView.h

+ SetMaxDiskSize:

[Deprecated] Sets the size limit of the disk cache in bytes. The default disk cache limit is 1 GB.

+ (void)SetMaxDiskSize:(NSUInteger)size

Declared In

PAGImageView.h

– getComposition

Returns the current PAGComposition in the PAGImageView. Returns nil if the internal composition was loaded from a pag file path.

- (PAGComposition *__nullable)getComposition

Declared In

PAGImageView.h

– setComposition:

Sets a new PAGComposition to the PAGImageView with the maxFrameRate set to 30 fps. Note: If the composition is already added to another PAGImageView, it will be removed from the previous PAGImageView.

- (void)setComposition:(PAGComposition *)newComposition

Declared In

PAGImageView.h

– setComposition:maxFrameRate:

Sets a new PAGComposition and the maxFrameRate limit to the PAGImageView. Note: If the composition is already added to another PAGImageView, it will be removed from the previous PAGImageView.

- (void)setComposition:(PAGComposition *)newComposition maxFrameRate:(float)maxFrameRate

Declared In

PAGImageView.h

– getPath

Returns the file path set by the setPath() method.

- (nullable NSString *)getPath

Declared In

PAGImageView.h

– setPath:

Loads a pag file from the specified path, returns false if the file does not exist, or it is not a valid pag file.

- (BOOL)setPath:(NSString *)path

Declared In

PAGImageView.h

– setPath:maxFrameRate:

Loads a pag file from the specified path with the maxFrameRate limit, returns false if the file does not exist, or it is not a valid pag file.

- (BOOL)setPath:(NSString *)filePath maxFrameRate:(float)maxFrameRate

Declared In

PAGImageView.h

– setPathAsync:completionBlock:

Asynchronously load a PAG file from the specific path, a block with PAGFile will be called when loading is complete. If loading fails, PAGFile will be set to nil.

- (void)setPathAsync:(NSString *)filePath completionBlock:(void ( ^ ) ( PAGFile *))callback

Declared In

PAGImageView.h

– setPathAsync:maxFrameRate:completionBlock:

Asynchronously load a PAG file from the specific path with the maxFrameRate limit, a block with PAGFile will be called when loading is complete. If loading fails, PAGFile will be set to nil.

- (void)setPathAsync:(NSString *)filePath maxFrameRate:(float)maxFrameRate completionBlock:(void ( ^ ) ( PAGFile *))callback

Declared In

PAGImageView.h

– cacheAllFramesInMemory

If set to true, the PAGImageView loads all image frames into the memory, which will significantly increase the rendering performance but may cost lots of additional memory. Use it when you prefer rendering speed over memory usage. If set to false, the PAGImageView loads only one image frame at a time into the memory. The default value is false.

- (BOOL)cacheAllFramesInMemory

Declared In

PAGImageView.h

– setCacheAllFramesInMemory:

Sets the value of the cacheAllFramesInMemory property.

- (void)setCacheAllFramesInMemory:(BOOL)enable

Declared In

PAGImageView.h

– renderScale

This value defines the scale factor for the size of the cached image frames, which ranges from 0.0 to 1.0. A scale factor less than 1.0 may result in blurred output, but it can reduce graphics memory usage, increasing the rendering performance. The default value is 1.0.

- (float)renderScale

Declared In

PAGImageView.h

– setRenderScale:

Sets the value of the renderScale property.

- (void)setRenderScale:(float)scale

Declared In

PAGImageView.h

– repeatCount

The total number of times the animation is set to play. The default is 1, which means the animation will play only once. If the repeat count is set to 0 or a negative value, the animation will play infinity times.

- (int)repeatCount

Declared In

PAGImageView.h

– setRepeatCount:

Set the number of times the animation to play.

- (void)setRepeatCount:(int)repeatCount

Declared In

PAGImageView.h

– addListener:

Adds a listener to the set of listeners that are sent events through the life of an animation, such as start, repeat, and end. PAGImageView only holds a weak reference to the listener.

- (void)addListener:(id<PAGImageViewListener>)listener

Declared In

PAGImageView.h

– removeListener:

Removes the specified listener from the set of listeners

- (void)removeListener:(id<PAGImageViewListener>)listener

Declared In

PAGImageView.h

– currentFrame

Returns the current frame index the PAGImageView is rendering.

- (NSUInteger)currentFrame

Declared In

PAGImageView.h

– setCurrentFrame:

Sets the frame index for the PAGImageView to render.

- (void)setCurrentFrame:(NSUInteger)currentFrame

Declared In

PAGImageView.h

– numFrames

Returns the number of frames in the PAGImageView in one loop. Note that the value may change if the associated PAGComposition was modified.

- (NSUInteger)numFrames

Declared In

PAGImageView.h

– currentImage

Returns a UIImage capturing the contents of the current PAGImageView.

- (UIImage *)currentImage

Declared In

PAGImageView.h

– play

Starts to play the animation from the current position. Calling the play() method when the animation is already playing has no effect. The play() method does not alter the animation’s current position. However, if the animation previously reached its end, it will restart from the beginning.

- (void)play

Declared In

PAGImageView.h

– pause

Cancels the animation at the current position. Calling the play() method can resume the animation from the last paused position.

- (void)pause

Declared In

PAGImageView.h

– isPlaying

Indicates whether this PAGImageView is playing.

- (BOOL)isPlaying

Declared In

PAGImageView.h

– flush

Call this method to render current position immediately. Note that all the changes previously made to the PAGImageView will only take effect after this method is called. If the play() method is already called, there is no need to call it manually since it will be automatically called every frame. Returns true if the content has changed.

- (BOOL)flush

Declared In

PAGImageView.h