CN108319420B - Picture loading method and device - Google Patents

Picture loading method and device Download PDF

Info

Publication number
CN108319420B
CN108319420B CN201810002267.2A CN201810002267A CN108319420B CN 108319420 B CN108319420 B CN 108319420B CN 201810002267 A CN201810002267 A CN 201810002267A CN 108319420 B CN108319420 B CN 108319420B
Authority
CN
China
Prior art keywords
picture
target picture
loading
state
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810002267.2A
Other languages
Chinese (zh)
Other versions
CN108319420A (en
Inventor
汪刚
张文明
陈少杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baosheng China Technology Industry Co ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810002267.2A priority Critical patent/CN108319420B/en
Publication of CN108319420A publication Critical patent/CN108319420A/en
Application granted granted Critical
Publication of CN108319420B publication Critical patent/CN108319420B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a picture loading method and a picture loading device, wherein the method comprises the following steps: s1, when the mouse operation of the original picture is obtained, obtaining a target picture state corresponding to the mouse event according to the mouse event of the original picture; the mouse event and the corresponding target picture state are stored in a pre-associated mode; s2, acquiring a target picture url corresponding to the target picture state according to the target picture state; the target picture state and the corresponding target picture url are stored in a pre-associated mode; and S3, calling a picture loading method in the pre-created UIButton classification to load the target picture according to the target picture state and the target picture url. The invention realizes the automatic loading of the target picture, has simple use and high loading speed, and improves the code sending and reusing rate and the development efficiency.

Description

Picture loading method and device
Technical Field
The invention belongs to the field of application development, and particularly relates to a picture loading method and device.
Background
With the rapid development of mobile terminals of mobile phones, the types of application software are increasingly rich, and the interactivity between products and users is stronger. In order to enhance the user experience, marketing modes of the application software are enriched, and display modes of various types of advertisement pictures in the application software are enriched.
At present, many pictures are displayed in a link form, and when the pictures are clicked, the corresponding page can be accessed. The pattern of the pictures may change dynamically, for example, the pictures displayed in the buttons may differ at different holidays. In addition, the style of the picture can change with the click state of the mouse, for example, when the mouse is placed on the picture, the picture in a high brightness state is displayed, when the mouse is not placed on the picture, the picture in a common state is displayed, and when the mouse clicks the picture, the picture in a selected state is displayed. At this time, different pictures need to be loaded according to the click states of the pictures.
In the prior art, when a picture style changes dynamically, a picture needs to be downloaded manually and then stored in a cache, and when an original picture needs to be updated, the required picture is loaded from the cache, which consumes a lot of time. In addition, the code is written for each clickable picture to realize the downloading of the picture, a large amount of code needs to be written, the development is difficult, and the maintainability is poor.
Disclosure of Invention
In order to overcome the problems of consuming a large amount of time, being difficult to develop and poor in maintainability in the loading of the dynamic pictures in the buttons or at least partially solve the problems, the invention provides a picture loading method and a picture loading device.
According to a first aspect of the present invention, there is provided a picture loading method, including:
s1, when the mouse operation of the original picture is obtained, obtaining a target picture state corresponding to the mouse event according to the mouse event of the original picture; the mouse event and the corresponding target picture state are stored in a pre-associated mode;
s2, acquiring a target picture url corresponding to the target picture state according to the target picture state; the target picture state and the corresponding target picture url are stored in a pre-associated mode;
and S3, calling a picture loading method in the pre-created UIButton classification to load the target picture according to the target picture state and the target picture url.
Specifically, the picture loading method includes one or more of a first method, a second method and a third method;
the first method is used for loading the target picture according to the picture state and the target picture url;
the second method is used for loading the target picture according to the picture state, the target picture url and a preset placeholder picture;
the third method is used for loading the target picture according to the picture loading request generated by the target picture url, the picture state, the placeholder picture and the processing entry when the target picture is successfully or unsuccessfully loaded.
Specifically, the step S2 specifically includes:
when the picture loading method comprises multiple methods of the first method, the second method and the third method, calling one method of the first method, the second method and the third method to load the target picture.
Specifically, the step S2 specifically includes:
when the first method is called to load the target picture, calling the second method inside the first method, transferring the placeholder picture of a parameter of a second method in the first method to be a null value, calling the third method inside the second method in the first method, and transferring the processing entry of the parameter of the third method in the second method to be a null value;
when the second method is called to load the target picture, the third method is called inside the second method, and the processing entry of the parameter of the third method in the second method is transferred to be a null value.
Specifically, the step of calling one of the first method, the second method, and the third method to load the target picture specifically includes:
determining whether the target picture is being downloaded in the third method;
if the target picture is being downloaded, directly returning to wait for the target picture to be downloaded; or,
and if the target picture is not being downloaded, canceling the historical downloading operation of the target picture, and judging whether the target picture exists in the cache of the download manager.
Specifically, the step of determining whether the target picture exists in the cache of the download manager specifically includes:
if the target picture exists in the cache, loading the target picture from the cache; or,
and if the target picture does not exist in the cache, using the download manager to download the target picture.
Specifically, the step of downloading the target picture by using the download manager specifically includes:
if the target picture is downloaded successfully, loading the target picture, and storing the target picture in the cache; or,
and if the target picture fails to be downloaded, replacing the original picture with the placeholder picture.
According to a second aspect of the present invention, there is provided a picture loading apparatus comprising:
the first obtaining unit is used for obtaining a target picture state corresponding to a mouse event according to the mouse event of the original picture when the mouse operation of the original picture is obtained; the mouse event and the corresponding target picture state are stored in a pre-associated mode;
the second acquisition unit is used for acquiring a target picture url corresponding to the target picture state according to the target picture state; the target picture state and the corresponding target picture url are stored in a pre-associated mode;
and the loading unit is used for calling a picture loading method in the pre-established UIButton classification to load the target picture according to the target picture state and the target picture url.
According to a third aspect of the present invention, there is provided a picture loading apparatus comprising:
at least one processor, at least one memory, and a bus; wherein,
the processor and the memory complete mutual communication through the bus;
the memory stores program instructions executable by the processor, which when called by the processor are capable of performing the method as previously described.
According to a fourth aspect of the invention, there is provided a non-transitory computer readable storage medium storing a computer program of the method as described above.
The invention provides a picture loading method and a device, the method packages a complex picture loading process into a classification, when a target picture needs to be loaded, only the classification needs to be imported, and the picture loading method provided by the classification is called according to the picture state corresponding to the mouse event of the original picture and the url of the target picture corresponding to the picture state, so that the automatic loading of the target picture is realized, the use is simple, the loading speed is high, and the code sending and reusing rate and the development efficiency are improved.
Drawings
Fig. 1 is a schematic overall flow chart of a picture loading method according to an embodiment of the present invention;
fig. 2 is a schematic view of an overall structure of a picture loading apparatus according to an embodiment of the present invention;
fig. 3 is a schematic view of an overall structure of the picture loading device according to the embodiment of the present invention.
Detailed Description
The following detailed description of embodiments of the present invention is provided in connection with the accompanying drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
Fig. 1 is a schematic overall flow chart of a picture loading method according to an embodiment of the present invention, where the method includes: s1, when the mouse operation of the original picture is obtained, obtaining a target picture state corresponding to the mouse event according to the mouse event of the original picture; the mouse event and the corresponding target picture state are stored in a pre-associated mode; s2, acquiring a target picture url corresponding to the target picture state according to the target picture state; the target picture state and the corresponding target picture url are stored in a pre-associated mode; and S3, calling a picture loading method in the pre-created UIButton classification to load the target picture according to the target picture state and the target picture url.
Specifically, in S1, the original image has a link and can be clicked. The mouse event of the original picture comprises one or more of clicking a mouse, double clicking the mouse, moving the mouse above the original picture and moving the mouse out of the position above the original picture. The picture states are enumeration types including a highlight state, a selected state, a disabled state and a normal state, but the embodiment is not limited to these four picture states. And taking the original display of the original picture as a common state, wherein the highlight state is highlight display relative to the common state. The selected state is the display of the original image when being clicked, and the forbidden state is the display of the original image which is marked to be incapable of being clicked. And each mouse event has a picture state corresponding to the mouse event, if the picture state corresponding to the mouse event moved into the position above the original picture is in a highlighted state or a forbidden state, the picture state corresponding to the mouse event is in a selected state, and the picture state corresponding to the mouse event moved out of the position above the original picture is in a common state. In S2, since the target picture is dynamically changed, it needs to be loaded from the server, and different target pictures correspond to different urls. And acquiring a picture state corresponding to the mouse event according to the mouse event of the original picture. And acquiring the url of the target picture corresponding to the picture state according to the picture state.
In S3, a classification of UIButton, which is a commonly used control in IOS, is created in advance. The classification may be named UIButton + image. And defining a picture loading method in the classification, wherein the picture loading method is used for loading pictures. And transmitting the picture state and the target picture url as parameters to the picture loading method so that the picture loading method loads the target picture which can be clicked dynamically according to the picture state and the target picture url.
According to the invention, the complicated picture loading process is packaged into one classification, when the target picture needs to be loaded, only the classification needs to be imported, and the picture loading method provided by the classification is called according to the picture state corresponding to the mouse event of the original picture and the url of the target picture corresponding to the picture state, so that the automatic loading of the target picture is realized, the use is simple, the loading speed is high, and the code sending and reusing rate and the development efficiency are improved.
On the basis of the foregoing embodiment, the picture loading method in this embodiment includes one or more of a first method, a second method, and a third method; the first method is used for loading the target picture according to the picture state and the target picture url; the second method is used for loading the target picture according to the picture state, the target picture url and a preset placeholder picture; the third method is used for loading the target picture according to the picture loading request generated by the target picture url, the picture state, the placeholder picture and the processing entry when the target picture is successfully or unsuccessfully loaded.
Specifically, the picture loading method in the classification may be one or more of the first method, the second method, and the third method. And transmitting the picture state and the target picture url into the first method, so that the first method loads the target picture according to the picture state and the target picture url. The interface function provided by the first method is as follows:
setImageForState:(UIControlState)state
withURL:(NSURL*)url
the state is the picture state, is an enumeration type, and is one of a normal state normal, a highlighted state high, a disabled state disabled, and a selected state selected, but the present embodiment is not limited to these four picture states. And url is url of the target picture when the target picture is loaded. The first method is simple to use, can finish the loading of the target picture only by inputting the state parameter and the url parameter, and is suitable for the conditions that the target picture is small and the downloading speed is high.
And transmitting the picture state, the target picture url and the preset placeholder picture into the second method, so that the second method loads the target picture according to the picture state, the target picture url and the preset placeholder picture. The second method provides an interface function with a placeholder picture as follows:
(void)setImageForState:(UIControlState)state
withURL:(NSURL*)url
placeholderImage:(UIImage*)placeholderImage
in addition to the two parameters in the first method, a placeholder picture placeholdermmage parameter is added for setting placeholders. The second method sets a placeholder picture before the target picture is loaded. And under the condition that the target picture is large and the downloading speed is low, setting the placeholder picture can improve the user experience.
Generating a picture loading request according to the target picture url, and transmitting the picture loading request, the picture state, the placeholder picture and a processing entry when the target picture is successfully and unsuccessfully loaded into the third method as parameters, so that the third method can load the target picture according to the picture loading request, the picture state, the placeholder picture and the processing entry. The third method may use the processing entry to call the processing entry for additional processing when picture loading is successful or failed. The interface function of the third method is:
(void)ImageForState:(UIControlState)state
withURLRequest:(NSURLRequest*)urlRequest
placeImage:(UIImage*)placeholderImage
success:(void(^)(NSURLRequest*request,UIImage*image))success
failure:(void(^)(NSError*error))failure
wherein, the urlRequest parameter is a picture loading request. Compared with the second method, the interface function of the third method has two more parameters, namely callback parameter success when the picture loading is successful and callback parameter failure when the picture loading is failed. Due to the addition of the two parameters, an additional processing entry is added to the target picture loading result, for example, a user is prompted that picture loading fails when the picture loading fails, so that the user experience is improved.
On the basis of the foregoing embodiment, the step S2 specifically includes: when the picture loading method comprises multiple methods of the first method, the second method and the third method, calling one method of the first method, the second method and the third method to load the target picture.
Specifically, when the image loading method includes the first method, the second method, and the third method, one of the three methods in the classification is called according to a scene requirement to load the target image, so that loading of the target image in different scenes is met.
On the basis of the foregoing embodiments, in this embodiment, the step S2 specifically includes: when the first method is called to load the target picture, the second method is called inside the first method, the placeholder picture of the parameter of the second method in the first method is transferred to be a null value, the third method is called inside the second method in the first method, and the processing entry of the parameter of the third method in the second method is transferred to be a null value; when the second method is called to load the target picture, the third method is called inside the second method, and the processing entry of the parameter of the third method in the second method is transferred to be a null value.
Specifically, the second method is directly called inside the first method, and the placeholder picture of the parameter of the second method in the first method is transferred to be a null value, so that the implementation of the first method is met. And directly calling the third method inside the second method, and transmitting the processing entry of the parameter of the third method in the second method as a null value. Thereby satisfying the implementation of the second method. The first method, the second method and the third method are mutually related and called, so that specific target picture loading is realized only in the third method. And only calling the second method inside the first method, and only calling a third method inside the second method in the first method. When the second method is called to load the target picture, the third method is only called in the second method, so that the simplification of the code is realized. And calling the first method, the second method or the third method to load the target picture.
On the basis of the foregoing embodiment, the step of invoking one of the first method, the second method, and the third method to load the target picture in this embodiment specifically includes: determining whether the target picture is being downloaded in the third method; if the target picture is being downloaded, directly returning to wait for the target picture to be downloaded; or if the target picture is not being downloaded, canceling the historical downloading operation of the target picture, and judging whether the target picture exists in the cache of the download manager.
Specifically, since the second method is invoked inside the first method, and the third method is invoked in the second method in the first method and in a separate second method, only the loading of the specific target picture needs to be implemented in the third method. And in the third method, judging whether the target picture is being downloaded by using an isactive TaskURLEqualToURLRequest method according to the url of the target picture. If the target picture is being downloaded, directly returning, namely returning, and waiting for the target picture to be downloaded. If the target picture is not being downloaded, canceling the historical downloading operation of the target picture by using a cancel ImageDownloadTaskForState method, creating a download manager, acquiring the picture in the cache of the download manager by using the ImageCache attribute of the download manager, and judging whether the target picture exists in the cache of the download manager. And judging whether the target picture exists in the cached pictures cachedImap.
On the basis of the foregoing embodiment, the step of determining whether the target picture exists in the cache of the download manager in this embodiment specifically includes: if the target picture exists in the cache, loading the target picture from the cache; or if the target picture does not exist in the cache, using the download manager to download the target picture.
Specifically, if the target picture exists in the cache, the target picture is directly loaded from the cache, otherwise, the target picture is downloaded by using the download manager. And calling a download function downloadImageForURLRequest by using the download manager to download the target picture, and transmitting the target picture url and a callback parameter into the download function. And the callback comprises the steps of storing the target picture into the cache after the target picture is successfully loaded, and then calling a picture loading function setImageForState to display the target picture.
On the basis of the foregoing embodiment, in this embodiment, the step of downloading the target picture by using the download manager specifically includes: if the target picture is downloaded successfully, loading the target picture, and storing the target picture in the cache; or if the target picture fails to be downloaded, replacing the original picture with the placeholder picture.
Specifically, if the target picture is downloaded successfully, the target picture is loaded and stored in the cache of the download manager. And if the target picture fails to be downloaded, canceling the current downloading and printing an error message. And simultaneously acquiring the placeholder picture placeImage. Specifically, whether the placeholder picture exists or not is judged, and if yes, the placeholder picture is displayed to the position of the original picture by using a setImage setting method of the placeholder picture. And at the moment, the target picture is downloaded again by using the download manager, and the target picture is loaded after the download is successful.
In this embodiment, a download manager is used to download the target picture, and a cache mechanism is provided, so that timeliness of the target picture is guaranteed, traffic is saved, and user experience is improved.
In another embodiment of the present invention, a picture loading apparatus is provided, and fig. 2 is a schematic diagram of an overall structure of the picture loading apparatus provided in the embodiment of the present invention, where the apparatus includes a first obtaining unit 1, a second obtaining unit 2, and a loading unit 3, where:
the first obtaining unit 1 is configured to obtain, when a mouse operation of an original picture is obtained, a target picture state corresponding to a mouse event according to the mouse event of the original picture; the mouse event and the corresponding target picture state are stored in a pre-associated mode; the second obtaining unit 2 is configured to obtain a target picture url corresponding to the target picture state according to the target picture state; the target picture state and the corresponding target picture url are stored in a pre-associated mode; and the loading unit 3 is used for calling a picture loading method in a pre-created UIButton classification to load the target picture according to the target picture state and the target picture url.
Specifically, the original picture has a link and can be clicked. The mouse event of the original picture comprises one or more of clicking a mouse, double clicking the mouse, moving the mouse above the original picture and moving the mouse out of the position above the original picture. The picture states are enumeration types including a highlight state, a selected state, a disabled state and a normal state, but the embodiment is not limited to these four picture states. And taking the original display of the original picture as a common state, wherein the highlight state is highlight display relative to the common state. The selected state is the display of the original image when being clicked, and the forbidden state is the display of the original image which is marked to be incapable of being clicked. And each mouse event has a picture state corresponding to the mouse event, if the picture state corresponding to the mouse event moved into the position above the original picture is in a highlighted state or a forbidden state, the picture state corresponding to the mouse event is in a selected state, and the picture state corresponding to the mouse event moved out of the position above the original picture is in a common state. The first obtaining unit 1 obtains a picture state corresponding to the mouse event according to the mouse event of the original picture. Each picture state corresponds to a target picture. Because the target picture is dynamically changed, the target picture needs to be loaded from a server, and different target pictures correspond to different urls. And the second obtaining unit 2 obtains the url of the target picture corresponding to the picture state according to the picture state.
A UIButton classification is created in advance, and the UIButton is a control commonly used in the IOS. The classification may be named UIButton + image. And defining a picture loading method in the classification, wherein the picture loading method is used for loading pictures. And transmitting the picture state and the target picture url as parameters to the picture loading method so that the picture loading method loads the target picture which can be clicked dynamically according to the picture state and the target picture url. And the loading unit 3 calls a picture loading method in the pre-created UIButton classification to load the target picture, and displays the loaded target image to the position of the original picture to replace the original picture.
According to the invention, the complicated picture loading process is packaged into one classification, when the target picture needs to be loaded, only the classification needs to be imported, and the picture loading method provided by the classification is called according to the picture state corresponding to the mouse event of the original picture and the url of the target picture corresponding to the picture state, so that the automatic loading of the target picture is realized, the use is simple, the loading speed is high, and the code sending and reusing rate and the development efficiency are improved.
On the basis of the foregoing embodiment, the picture loading method in this embodiment includes one or more of a first method, a second method, and a third method; the first method is used for loading the target picture according to the picture state and the target picture url; the second method is used for loading the target picture according to the picture state, the target picture url and a preset placeholder picture; the third method is used for loading the target picture according to the picture loading request generated by the target picture url, the picture state, the placeholder picture and the processing entry when the target picture is successfully or unsuccessfully loaded.
On the basis of the foregoing embodiment, the loading unit in this embodiment is specifically configured to: when the picture loading method comprises multiple methods of the first method, the second method and the third method, calling one method of the first method, the second method and the third method to load the target picture.
On the basis of the foregoing embodiments, in this embodiment, the loading unit is specifically configured to: when the first method is called to load the target picture, calling the second method inside the first method, transferring the placeholder picture of a parameter of a second method in the first method to be a null value, calling the third method inside the second method in the first method, and transferring the processing entry of the parameter of the third method in the second method to be a null value; when the second method is called to load the target picture, the third method is called inside the second method, and the processing entry of the parameter of the third method in the second method is transferred to be a null value.
On the basis of the foregoing embodiment, the loading unit in this embodiment is further specifically configured to: determining whether the target picture is being downloaded in the third method; if the target picture is being downloaded, directly returning to wait for the target picture to be downloaded; or if the target picture is not being downloaded, canceling the historical downloading operation of the target picture, and judging whether the target picture exists in the cache of the download manager.
On the basis of the foregoing embodiment, the loading unit in this embodiment is further specifically configured to: if the target picture is downloaded successfully, loading the target picture, and storing the target picture in the cache; or if the target picture fails to be downloaded, replacing the original picture with the placeholder picture.
The present embodiment provides a picture loading device, and fig. 3 is a schematic diagram of an overall structure of the picture loading device according to the present embodiment, where the picture loading device includes: at least one processor 31, at least one memory 32, and a bus 33; wherein,
the processor 31 and the memory 32 complete mutual communication through the bus 33;
the memory 32 stores program instructions executable by the processor 31, and the processor calls the program instructions to execute the methods provided by the method embodiments, for example, the method includes: s1, when the mouse operation of the original picture is obtained, obtaining a target picture state corresponding to the mouse event according to the mouse event of the original picture; the mouse event and the corresponding target picture state are stored in a pre-associated mode; s2, acquiring a target picture url corresponding to the target picture state according to the target picture state; the target picture state and the corresponding target picture url are stored in a pre-associated mode; and S3, calling a picture loading method in the pre-created UIButton classification to load the target picture according to the target picture state and the target picture url.
The present embodiments provide a non-transitory computer-readable storage medium storing computer instructions that cause the computer to perform the methods provided by the above method embodiments, for example, including: s1, when the mouse operation of the original picture is obtained, obtaining a target picture state corresponding to the mouse event according to the mouse event of the original picture; the mouse event and the corresponding target picture state are stored in a pre-associated mode; s2, acquiring a target picture url corresponding to the target picture state according to the target picture state; the target picture state and the corresponding target picture url are stored in a pre-associated mode; and S3, calling a picture loading method in the pre-created UIButton classification to load the target picture according to the target picture state and the target picture url.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The above-described embodiments of the picture loading apparatus are merely illustrative, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, that is, may be located in one place, or may also be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, the method of the present application is only a preferred embodiment and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A picture loading method is characterized by comprising the following steps:
s1, when the mouse operation of the original picture is obtained, obtaining a target picture state corresponding to the mouse event according to the mouse event of the original picture; the mouse event and the corresponding target picture state are stored in a pre-associated mode;
s2, acquiring a target picture url corresponding to the target picture state according to the target picture state; the target picture state and the corresponding target picture url are stored in a pre-associated mode;
s3, calling a picture loading method in a pre-established UIButton classification to load the target picture according to the target picture state and the target picture url;
the picture loading method comprises a first method, a second method and a third method;
the first method is used for loading the target picture according to the picture state and the target picture url;
the second method is used for loading the target picture according to the picture state, the target picture url and a preset placeholder picture;
the third method is used for loading the target picture according to the picture loading request generated by the target picture url, the picture state, the placeholder picture and the processing entry when the target picture is successfully or unsuccessfully loaded;
the step S3 specifically includes:
when the first method is called to load the target picture, calling the second method inside the first method, transferring the placeholder picture of a parameter of a second method in the first method to be a null value, calling the third method inside the second method in the first method, and transferring the processing entry of the parameter of the third method in the second method to be a null value;
when the second method is called to load the target picture, the third method is called inside the second method, and the processing entry of the parameter of the third method in the second method is transferred to be a null value.
2. The method according to claim 1, wherein the step S2 specifically includes:
when the picture loading method comprises multiple methods of the first method, the second method and the third method, calling one method of the first method, the second method and the third method to load the target picture.
3. The method according to claim 1, wherein the step of invoking one of the first method, the second method, and the third method to load the target picture specifically comprises:
determining whether the target picture is being downloaded in the third method;
if the target picture is being downloaded, directly returning to wait for the target picture to be downloaded; or,
and if the target picture is not being downloaded, canceling the historical downloading operation of the target picture, and judging whether the target picture exists in the cache of the download manager.
4. The method of claim 3, wherein the step of determining whether the target picture exists in the cache of the download manager specifically comprises:
if the target picture exists in the cache, loading the target picture from the cache; or,
and if the target picture does not exist in the cache, using the download manager to download the target picture.
5. The method according to claim 4, wherein the step of downloading the target picture using the download manager specifically comprises:
if the target picture is downloaded successfully, loading the target picture, and storing the target picture in the cache; or,
and if the target picture fails to be downloaded, replacing the original picture with the placeholder picture.
6. A picture loading apparatus, comprising:
the first obtaining unit is used for obtaining a target picture state corresponding to a mouse event according to the mouse event of the original picture when the mouse operation of the original picture is obtained; the mouse event and the corresponding target picture state are stored in a pre-associated mode;
the second acquisition unit is used for acquiring a target picture url corresponding to the target picture state according to the target picture state; the target picture state and the corresponding target picture url are stored in a pre-associated mode;
the loading unit is used for calling a picture loading method in a pre-established UIButton classification to load the target picture according to the target picture state and the target picture url;
the picture loading method comprises a first method, a second method and a third method;
the first method is used for loading the target picture according to the picture state and the target picture url;
the second method is used for loading the target picture according to the picture state, the target picture url and a preset placeholder picture;
the third method is used for loading the target picture according to the picture loading request generated by the target picture url, the picture state, the placeholder picture and the processing entry when the target picture is successfully or unsuccessfully loaded;
the loading unit is specifically configured to:
when the first method is called to load the target picture, calling the second method inside the first method, transferring the placeholder picture of a parameter of a second method in the first method to be a null value, calling the third method inside the second method in the first method, and transferring the processing entry of the parameter of the third method in the second method to be a null value;
when the second method is called to load the target picture, the third method is called inside the second method, and the processing entry of the parameter of the third method in the second method is transferred to be a null value.
7. A picture loading apparatus, comprising:
at least one processor, at least one memory, and a bus; wherein,
the processor and the memory complete mutual communication through the bus;
the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform the method of any of claims 1 to 5.
8. A non-transitory computer-readable storage medium storing computer instructions that cause a computer to perform the method of any one of claims 1 to 5.
CN201810002267.2A 2018-01-02 2018-01-02 Picture loading method and device Active CN108319420B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810002267.2A CN108319420B (en) 2018-01-02 2018-01-02 Picture loading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810002267.2A CN108319420B (en) 2018-01-02 2018-01-02 Picture loading method and device

Publications (2)

Publication Number Publication Date
CN108319420A CN108319420A (en) 2018-07-24
CN108319420B true CN108319420B (en) 2020-04-10

Family

ID=62892895

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810002267.2A Active CN108319420B (en) 2018-01-02 2018-01-02 Picture loading method and device

Country Status (1)

Country Link
CN (1) CN108319420B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110929191A (en) * 2019-10-25 2020-03-27 北京城市网邻信息技术有限公司 Picture loading method and device, terminal and storage medium
CN110825477A (en) * 2019-11-04 2020-02-21 上海达梦数据库有限公司 Method, device and equipment for loading graphical interface and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102810101A (en) * 2011-06-03 2012-12-05 北京搜狗科技发展有限公司 Webpage pre-reading method and device and browser
CN103914450A (en) * 2012-12-31 2014-07-09 北京新媒传信科技有限公司 Method and device for presenting web graphics in mobile terminal platform
CN104156251A (en) * 2014-08-22 2014-11-19 广州华多网络科技有限公司 Picture processing method and device
CN105045592A (en) * 2015-07-24 2015-11-11 北京金山安全软件有限公司 Picture display method and device
CN106201192A (en) * 2016-07-01 2016-12-07 北京小米移动软件有限公司 Click on event response method, device and terminal
EP3119064A1 (en) * 2014-03-12 2017-01-18 Huawei Device Co., Ltd. A lock screen method and mobile terminal
CN107085612A (en) * 2017-05-15 2017-08-22 腾讯科技(深圳)有限公司 media content display method, device and storage medium
CN107273408A (en) * 2017-04-28 2017-10-20 努比亚技术有限公司 Page processing method, mobile terminal and computer-readable recording medium
CN107450808A (en) * 2017-09-22 2017-12-08 北京知道创宇信息技术有限公司 The mouse pointer localization method and computing device of a kind of browser

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102810101A (en) * 2011-06-03 2012-12-05 北京搜狗科技发展有限公司 Webpage pre-reading method and device and browser
CN103914450A (en) * 2012-12-31 2014-07-09 北京新媒传信科技有限公司 Method and device for presenting web graphics in mobile terminal platform
EP3119064A1 (en) * 2014-03-12 2017-01-18 Huawei Device Co., Ltd. A lock screen method and mobile terminal
CN104156251A (en) * 2014-08-22 2014-11-19 广州华多网络科技有限公司 Picture processing method and device
CN105045592A (en) * 2015-07-24 2015-11-11 北京金山安全软件有限公司 Picture display method and device
CN106201192A (en) * 2016-07-01 2016-12-07 北京小米移动软件有限公司 Click on event response method, device and terminal
CN107273408A (en) * 2017-04-28 2017-10-20 努比亚技术有限公司 Page processing method, mobile terminal and computer-readable recording medium
CN107085612A (en) * 2017-05-15 2017-08-22 腾讯科技(深圳)有限公司 media content display method, device and storage medium
CN107450808A (en) * 2017-09-22 2017-12-08 北京知道创宇信息技术有限公司 The mouse pointer localization method and computing device of a kind of browser

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
网页加载过程的监控与统计分析;仲晓;《中国优秀硕士学位论文全文数据库 信息科技辑》;20150415;全文 *

Also Published As

Publication number Publication date
CN108319420A (en) 2018-07-24

Similar Documents

Publication Publication Date Title
US11144711B2 (en) Webpage rendering method, device, electronic apparatus and storage medium
US11025750B2 (en) Determining whether to perform requests at a server or at a client device based on resources provided by the client device
US10325009B2 (en) Method and apparatus for using custom component parsing engine to parse tag of custom component
EP3191942B1 (en) Interactive web application editor
CN107870821B (en) Cross-platform calling method and system for application program
US11706331B2 (en) Information processing method and apparatus, storage medium, and electronic device
CN107526598B (en) Network page jump control method and system
WO2023093429A1 (en) Micro-application running method and apparatus, and device, storage medium and program product
CN104995927A (en) Systems and methods for building and using hybrid mobile applications
CN104516885A (en) Implementation method and device of browse program double-kernel assembly
US10594764B2 (en) Request cache to improve web applications performance
CN103019712A (en) Integrated application
CN108319420B (en) Picture loading method and device
CN109725887B (en) Data interaction method and device based on message research and development framework and terminal equipment
CN105847319A (en) Mobile terminal network request method and system
CN108334322B (en) Data request method and system of MVC framework
CN112764746B (en) Data processing method, device, electronic equipment and storage medium
CN111294377A (en) Network request sending method of dependency relationship, terminal device and storage medium
CN113157270A (en) Page adaptation method and device
CN111008050B (en) Page task execution method, device, terminal and storage medium
JP2021068414A (en) Wrapping method, registration method, device, rendering device, and program
CN107343042B (en) Browser traffic hijacking method and device and mobile terminal
CN113282852A (en) Method and device for editing webpage
CN116301866A (en) Cloud rendering method, device, equipment and storage medium based on custom software
CN114095758B (en) Cloud image intercepting method and related device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20240613

Address after: 100000 616, floor 6, 33 Suzhou street, Haidian District, Beijing

Patentee after: Baosheng (China) Technology Industry Co.,Ltd.

Country or region after: China

Address before: 430000 East Lake Development Zone, Wuhan City, Hubei Province, No. 1 Software Park East Road 4.1 Phase B1 Building 11 Building

Patentee before: WUHAN DOUYU NETWORK TECHNOLOGY Co.,Ltd.

Country or region before: China

TR01 Transfer of patent right