Method and apparatus for loading GIF animation in iOS

An animation and lazy loading technology, applied in the input/output process of data processing, special data processing applications, instruments, etc., can solve problems such as system crash and memory explosion, and achieve the effect of avoiding system crash

Active Publication Date: 2017-08-11
WUHAN DOUYU NETWORK TECH CO LTD
View PDF2 Cites 6 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] Among the current mainstream schemes, the loading and playing scheme of GIF animation is generally SDWebImage scheme, that is, UIImageView directly loads GIF animation. The biggest disadva

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and apparatus for loading GIF animation in iOS
  • Method and apparatus for loading GIF animation in iOS
  • Method and apparatus for loading GIF animation in iOS

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0052] The process of loading GIF animation is as follows:

[0053] S101. Create a web interface UIWebView by using lazy loading, and the name of the web interface is webView;

[0054]S102. Use the function [[UITapGestureRecognizer alloc]initWithTarget:selfaction:@selector(webViewTap:)], the [UITapGestureRecognizer alloc] on the right side of the function executes: create a gesture in memory, and the initWithTarget function executes: add The object of the message callback. The self in this statement represents which controller the added callback is executed on. @selector(webViewTap:) is the function webViewTap method selector, which is the process of executing a callback function. After the above function is executed, there will be an object UITapGestureRecognizer*gesture, the type of this object is UITapGestureRecognizer*, which is a gesture object. The above process completes adding gestures to the webpage interface webView, and at the same time use the function statement [w...

Embodiment 2

[0059] On the basis of embodiment 1, the process of pausing the GIF animation is as follows:

[0060] S201. Click the webpage interface webView to trigger a gesture operation and capture an image;

[0061] Call -(void)webViewTap:(UITapGestureRecognizer*)recognizer function, this function has no return value, the return value is void, this function has a parameter recognizer, the type of this parameter is UITapGestureRecognizer, recognizer represents a gesture, this gesture contains and Gesture-related information, this function calls the stopPalyGIF function, the writing process of the stopPalyGIF function is:

[0062] S201a, use Apple's own .size function CGSize webSize=self.webView.size to obtain the size of the screenshot, the size of this screenshot is webSize, wherein self.webView refers to the web interface webView for loading GIF animation, .size syntax It is a dot syntax, and its function meaning is to get the size of the webview of this web page interface, size is th...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The present invention discloses a method and an apparatus for loading the GIF animation in the iOS, and relates to the field of Internet mobile application development. The method comprises the following steps: creating a webpage interface by using lazy loading; creating a gesture in the memory, and adding a message callback object for the created gesture; setting the display size and the display position of the web page interface; adding the web page interface to the current controller; and obtaining a network request to load the GIF animation, reading the uniform resource locator URL of the GIF animation stored in the network, and loading the GIF animation through the URL. According to the method and apparatus disclosed by the present invention, without caching the loaded animation, the memory is released after being used up, and when loading the GIF animation, memory surge cannot occurs, so that system crashed can be avoided.

Description

technical field [0001] The invention relates to the field of Internet mobile terminal application development, in particular to a method and device for loading GIF animation in iOS. Background technique [0002] In Internet mobile applications, GIF (Graphics InterchangeFormat, Image Interchange Format) animations need to be played in many places. iOS (Apple Mobile Device Operating System) development provides some methods for loading GIF animations, and some open source frameworks provide loading Method for GIF animation. [0003] Among the current mainstream schemes, the loading and playing scheme of GIF animation is generally SDWebImage scheme, that is, UIImageView directly loads GIF animation. The biggest disadvantage of this scheme is: when the loaded GIF animation exceeds 200kb, the animation rendering of iOS will occupy more than 200M of memory , it is easy to cause memory surge and cause system crash. Contents of the invention [0004] The purpose of the present i...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F17/30G06F3/0484
CPCG06F3/04845G06F16/9574
Inventor 汪刚张文明陈少杰
Owner WUHAN DOUYU NETWORK TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products