CN108334393A - A kind of iOS end-views resource multiplexing method, storage medium, equipment and system - Google Patents

A kind of iOS end-views resource multiplexing method, storage medium, equipment and system Download PDF

Info

Publication number
CN108334393A
CN108334393A CN201810024350.XA CN201810024350A CN108334393A CN 108334393 A CN108334393 A CN 108334393A CN 201810024350 A CN201810024350 A CN 201810024350A CN 108334393 A CN108334393 A CN 108334393A
Authority
CN
China
Prior art keywords
view
sub
resource
views
new
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.)
Granted
Application number
CN201810024350.XA
Other languages
Chinese (zh)
Other versions
CN108334393B (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.)
Wuhan Douyu Network Technology 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 CN201810024350.XA priority Critical patent/CN108334393B/en
Publication of CN108334393A publication Critical patent/CN108334393A/en
Application granted granted Critical
Publication of CN108334393B publication Critical patent/CN108334393B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of iOS end-views resource multiplexing method, storage medium, equipment and systems, are related to view resource multiplex technical field, and this method includes:The view resource for needing to be shown is obtained, and view resource is divided into multiple sub- views;One reuse label is added to multiple sub- views;By the sub- view not shown according in reuse label one resource pool of deposit of its pairing;When the sub- view originally shown is moved to outside screen, the sub- view originally shown is stored in resource pool, opens and shows new view work;Identification is stored in the sub- view in resource pool, if in the presence of the sub- view of the new views registered required with new view work is shown, matched sub- view is shown as new view;If the sub- view in storage pool is not consistent with new view, creates new view resource and shown.View resource recycling except screen is reduced Memory Load by the present invention, improves system performance.

Description

A kind of iOS end-views resource multiplexing method, storage medium, equipment and system
Technical field
The present invention relates to view resource multiplex technical fields, and in particular to a kind of iOS end-views resource multiplexing method, storage Medium, equipment and system.
Background technology
Currently, in the exploitation of iOS clients, UIScrollView is one of highest view of frequency of use, is formed substantially Unit can be the subclass that UITableViewCell can also be other UIView, for the view resource that needs slide, if Using UItableview either UIcollectionView systems will to the UItableviewCell of corresponding sliding or UIcollectionViewCell carries out corresponding resource reclaim multiplexing process, to save memory consumption.
However in the practice of iOS clients exploitation, still has and largely UIScrollView views is used to load cunning Dynamic view, since there is no resource reclaims to be multiplexed mechanism by UIScrollView, need to load a large amount of view resources when It waits, unavoidably causes the mistake large overhead of memory, cause even to dodge using interim card and move back, this results in poor user experiences.
Invention content
In view of the deficiencies in the prior art, the purpose of the present invention is to provide a kind of iOS end-views resource multiplex sides View resource recycling except screen is reduced Memory Load by method, storage medium, equipment and system, improves system Performance.
To achieve the above objectives, the technical solution adopted by the present invention is that:
A kind of iOS end-views resource multiplexing method, includes the following steps:
The view resource for needing to be shown is obtained, and the view resource is divided into multiple sub- views;
One reuse label is added to multiple sub- views;
By the sub- view not shown according in reuse label one resource pool of deposit of its pairing;
When the sub- view originally shown is moved to outside screen, the sub- view originally shown is deposited Enter in the resource pool, opens and show new view work;
Identification is stored in the sub- view in the resource pool, if in the presence of the new view required with new view work is shown The matched sub- view shows the matched sub- view as the new view;
If the sub- view in the storage pool is not consistent with the new view, creates new view resource and shown Show.
Based on the above technical solution, iOS end-views resource multiplexing method further includes whether judging the sub- view The step of being present in screen:
Identify the frame of the sub- view shown;
Obtain the y of the sub- viewmaxAnd ymin, the ymaxFor each point on the sub- view on the vertical scale with it is described The top left co-ordinate of view resource is at a distance of maximum value, the yminFor each point on the sub- view on the vertical scale with the view The top left co-ordinate of resource is at a distance of minimum value;
As the ymaxMore than video display offset amount and yminWhen less than the sum of video display offset amount and screen height, then Judge the sub- view not on the screen.
Based on the above technical solution, iOS end-views resource multiplexing method is further comprising the steps of:
The sub- view being stored in the resource pool is identified successively by the way of enumerating according to the label that reuses.
Based on the above technical solution, in iOS end-views resource multiplexing method:
Lazy loading method is used when carrying out data load to the resource pool.
Invention additionally discloses a kind of storage mediums, are stored thereon with computer program, the computer program is by processor The step of above-mentioned iOS end-views resource multiplexing method is realized when execution.
Invention additionally discloses a kind of iOS end-views resource multiplex equipment, including memory, processor and it is stored in described deposit The computer program run on reservoir and on the processor, the processor are realized above-mentioned when executing the computer program The step of iOS end-view resource multiplexing methods.
Invention additionally discloses a kind of iOS end-views resource multiplex system, which includes:
View asset creation unit is used to create the view resource for obtaining and needing to be shown;
View resource division unit is used to the view resource being divided into multiple sub- views;
Sub- view mark unit is used to reuse label to multiple sub- view additions one respectively;
Resource pool unit, the sub- view for being used to not show are marked according to the reuse of its pairing and are carried out Storage;
Whether orientation judging unit, the sub- view currently shown for identification are still on screen;
Sub- view unit is called, is used for when the sub- view originally shown is moved to outside the screen, it will Original sub- view shown is stored in the resource pool, and is stored in the resource according to the reuse marker recognition The sub- view in pond, if in the presence of the sub- view of the new views registered required with new view work is shown, it will be matched The sub- view is shown as the new view;
Sub- view unit is created, if the sub- view being used in the storage pool is not consistent with the new view, New view resource is created to be shown.
Based on the above technical solution, the orientation judging unit in iOS end-views resource multiplex system includes:
Frame identification module, the frame of the sub- view shown for identification;
Orientation acquisition module is used for the y of the sub- viewmaxAnd ymin
Orientation recognition module is used for the y when the sub- viewmaxMore than video display offset amount and yminLess than regarding When the sum of frequency display offset amount and screen height, then judge the sub- view not on the screen.
Based on the above technical solution, in iOS end-views resource multiplex system:
According to reuse label, identification is stored in the money to the sub- view unit of calling successively by the way of enumerating The sub- view in the pond of source.
Based on the above technical solution, in iOS end-views resource multiplex system:
It is described to call sub- view unit to using lazy load side when resource pool progress data load.
Compared with the prior art, the advantages of the present invention are as follows:
(1) present invention by view resource by being divided into multiple sub- views, and is deposited after reusing label to each sub- view addition A resource pool is stored up, so that the later stage uses, and when new view is not present in resource pool, is creating new view resource;
Compared with prior art, the view resource recycling except screen can be reduced memory negative by the present invention Lotus improves system performance.
(2) present invention can identify the frame of the sub- view shown, to accurately be sentenced to the mobile of sub- view It is disconnected;
Compared with prior art, the present invention obtains more accurately sub- view location judging result, and guarantor is provided for entire work Barrier.
Description of the drawings
Fig. 1 is the flow chart of iOS end-view resource multiplexing methods in the embodiment of the present invention;
Fig. 2 is the structure diagram of intelligent loading equipemtn in the embodiment of the present invention;
Fig. 3 is the structure diagram of intelligent loading system in the embodiment of the present invention.
Specific implementation mode
The embodiment of the present invention is described in further detail below in conjunction with attached drawing.
Shown in Figure 1, the embodiment of the present invention provides a kind of iOS end-views resource multiplexing method, including:
The view resource for needing to be shown is obtained, and view resource is divided into multiple sub- views;
One reuse label is added to multiple sub- views;
By the sub- view not shown according in reuse label one resource pool of deposit of its pairing;
When the sub- view originally shown is moved to outside screen, the sub- view originally shown is stored in resource pool It is interior, it opens and shows new view work;
Identification is stored in the sub- view in resource pool, if in the presence of the son of the new views registered required with new view work is shown View shows matched sub- view as new view;
If the sub- view in storage pool is not consistent with new view, creates new view resource and shown.
In the present invention, view resource is divided, be divided into multiple sub- views and adds reuse label, and will not carried out The sub- view of display is stored according to the reuse label of its pairing in a resource pool, so that the later stage calls;
So as to which the view resource recycling except screen will be located at, Memory Load is reduced, system performance is improved.
Wherein, it is the set of all sub- views to need the view resource being shown, and includes not only being currently displayed at screen On sub- view, further include being located in same view resource and the following sub- view shown;
And the sub- view originally shown the sub- view that then current time is just showing on the screen.
It should be noted that the present invention can carry out reaching above-mentioned purpose by a view resource reuse mechanism, specific side Case is as follows:
It creates first and needs to show view resource on the screen, give the increased weight of sub- view of each view resource With mark reuseIdetifier, it is shown on UIScrollView according to normal logic;When screen starts sliding, reality is judged When whether also on the screen judge current all sub- views, not on the screen if there is sub- view, then be displayed on screen it Outer sub- view recycling, is put into the corresponding resource pool for reusing mark reuseIdetifier;During screen slides, If there is new data need to show, before creating new view resource, first according to the reuse mark identification need in resource pool Data to be shown whether there is in resource pool, and if it exists, the resource recycled before then be obtained, if it does not exist, then creating again New view resource is built, is ensured that in this way even if needing sub- view to be shown many in screen, but many sons can't be created View resource, reduces memory overhead.
In the present embodiment, iOS end-view resource multiplexing methods further include the steps that judging that sub- view whether there is in screen:
Identify the frame of the sub- view shown;
Obtain the y of sub- viewmaxAnd ymin, ymaxFor the upper left corner with view resource on the vertical scale of each point on sub- view Coordinate is at a distance of maximum value, yminFor each point on sub- view on the vertical scale the top left co-ordinate with view resource at a distance of minimum value;
Work as ymaxMore than video display offset amount and yminWhen less than the sum of video display offset amount and screen height, then judge Sub- view is not on the screen;
The present invention can identify the frame of the sub- view shown, thus to the mobile carry out accurate judgement of sub- view, More accurately sub- view location judging result is obtained, is provided safeguard for entire work.
Wherein, judging current sub- view, whether one of which implementation on the screen is as follows:
When screen slides, the layoutSubviews methods of rewriting system judge whether sub- view is shielding in this method On curtain;
According to currently making a decision from the frame sizes of view;
Obtain the y of sub- viewmaxAnd ymin, ymaxFor the upper left corner with view resource on the vertical scale of each point on sub- view Coordinate is at a distance of maximum value, yminFor each point on sub- view on the vertical scale the top left co-ordinate with view resource at a distance of minimum value;
Work as ymaxMore than video display offset amount and yminWhen less than the sum of video display offset amount and screen height, then judge Sub- view is not on the screen.
In the present embodiment, iOS end-view resource multiplexing methods are further comprising the steps of:
The sub- view being stored in resource pool is identified successively by the way of enumerating according to label is reused.
In the present embodiment, iOS end-view resource multiplexing methods:
Lazy loading method is used when carrying out data load to resource pool.
A kind of storage medium, is stored thereon with computer program, and above-mentioned iOS is realized when computer program is executed by processor The step of end-view resource multiplexing method.
It is shown in Figure 2, a kind of iOS end-views resource multiplex equipment, including memory, processor and it is stored in memory Computer program that is upper and running on a processor, processor realize that above-mentioned iOS end-views resource is multiple when executing computer program The step of with method.
Shown in Figure 3, a kind of iOS end-views resource multiplex system, which includes:
View asset creation unit is used to create the view resource for obtaining and needing to be shown;
View resource division unit is used to view resource being divided into multiple sub- views;
Sub- view mark unit is used to reuse label to multiple sub- view additions one respectively;
Resource pool unit, the sub- view for being used to not show are stored according to the reuse label of its pairing;
Whether orientation judging unit, the sub- view currently shown for identification are still on screen;
Sub- view unit is called, is used to, when the sub- view originally shown is moved to outside screen, will originally carry out In the sub- view deposit resource pool of display, and the sub- view in resource pool is stored according to marker recognition is reused, if in the presence of with it is aobvious The sub- view for showing the new views registered needed for new view work, matched sub- view is shown as new view;
Sub- view unit is created, if the sub- view being used in storage pool is not consistent with new view, creates new view Resource is shown.
In the present embodiment, the orientation judging unit of iOS end-view resource multiplex systems includes:
Frame identification module, the frame of the sub- view shown for identification;
Orientation acquisition module is used for the y of sub- viewmaxAnd ymin
Orientation recognition module is used for the y of group viewmaxMore than video display offset amount and yminIt is shown partially less than video When the sum of shifting amount and screen height, then judge sub- view not on the screen.
In the present embodiment, in iOS end-view resource multiplex systems:
Sub- view unit is called to be regarded according to label that identification is stored in resource pool successively by the way of enumerating is reused Figure.
In the present embodiment, in iOS end-view resource multiplex systems:
Lazy load side is used when sub- view unit being called to carry out data load to resource pool.
It should be noted that:Above-described embodiment provide system realize iOS end-view resource multiplexes operation when, only more than The division progress of each function module is stated for example, in practical application, it can be as needed and by above-mentioned function distribution by different work( Energy module is completed, i.e., the internal structure of system is divided into different function modules, to complete whole described above or portion Divide function.
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from Under the premise of the principle of the invention, several improvements and modifications can also be made, these improvements and modifications are also considered as the protection of the present invention Within the scope of.
The content not being described in detail in this specification belongs to the prior art well known to professional and technical personnel in the field.

Claims (10)

1. a kind of iOS end-views resource multiplexing method, which is characterized in that this approach includes the following steps:
The view resource for needing to be shown is obtained, and the view resource is divided into multiple sub- views;
One reuse label is added to multiple sub- views;
By the sub- view not shown according in reuse label one resource pool of deposit of its pairing;
When the sub- view originally shown is moved to outside screen, the sub- view originally shown is stored in institute It states in resource pool, opens and show new view work;
Identification is stored in the sub- view in the resource pool, if in the presence of the new views registered required with new view work is shown The sub- view, the matched sub- view is shown as the new view;
If the sub- view in the storage pool is not consistent with the new view, creates new view resource and shown.
2. iOS end-views resource multiplexing method as described in claim 1, which is characterized in that this method further includes described in judgement Sub- view whether there is in the screen the step of:
Identify the frame of the sub- view shown;
Obtain the y of the sub- viewmaxAnd ymin, the ymaxFor each point on the sub- view on the vertical scale with the view The top left co-ordinate of resource is at a distance of maximum value, the yminFor each point on the sub- view on the vertical scale with the view resource Top left co-ordinate at a distance of minimum value;
As the ymaxMore than video display offset amount and yminWhen less than the sum of video display offset amount and screen height, then judge The sub- view is not on the screen.
3. iOS end-views resource multiplexing method as described in claim 1, which is characterized in that this method is further comprising the steps of:
The sub- view being stored in the resource pool is identified successively by the way of enumerating according to the label that reuses.
4. iOS end-views resource multiplexing method as described in claim 1, it is characterised in that:
Lazy loading method is used when carrying out data load to the resource pool.
5. a kind of storage medium, is stored thereon with computer program, it is characterised in that:The computer program is executed by processor The step of any one of Shi Shixian the claims 1 to 4 the method.
6. a kind of iOS end-views resource multiplex equipment, including memory, processor and it is stored on the memory and described The computer program run on processor, it is characterised in that:The processor realizes above-mentioned power when executing the computer program Profit requires the step of any one of 1 to 4 the method.
7. a kind of iOS end-views resource multiplex system, which is characterized in that the system includes:
View asset creation unit is used to create the view resource for obtaining and needing to be shown;
View resource division unit is used to the view resource being divided into multiple sub- views;
Sub- view mark unit is used to reuse label to multiple sub- view additions one respectively;
Resource pool unit, the sub- view for being used to not show are deposited according to the reuse label of its pairing Storage;
Whether orientation judging unit, the sub- view currently shown for identification are still on screen;
Sub- view unit is called, is used for when the sub- view originally shown is moved to outside the screen, it will be original The sub- view shown is stored in the resource pool, and identifies the sub- view being stored in the resource pool, if In the presence of the sub- view of the new views registered required with new view work is shown, using the matched sub- view as described new View is shown;
Sub- view unit is created, if the sub- view being used in the storage pool is not consistent with the new view, is created New view resource is shown.
8. iOS end-views resource multiplex system as claimed in claim 7, which is characterized in that the orientation judging unit includes:
Frame identification module, the frame of the sub- view shown for identification;
Orientation acquisition module is used for the y of the sub- viewmaxAnd ymin
Orientation recognition module is used for the y when the sub- viewmaxMore than video display offset amount and yminIt is aobvious less than video When showing the sum of offset and screen height, then judge the sub- view not on the screen.
9. iOS end-views resource multiplex system as claimed in claim 7, it is characterised in that:
According to reuse label, identification is stored in the resource pool to the sub- view unit of calling successively by the way of enumerating The interior sub- view.
10. iOS end-views resource multiplex system as claimed in claim 7, it is characterised in that:
It is described to call sub- view unit to using lazy load side when resource pool progress data load.
CN201810024350.XA 2018-01-10 2018-01-10 iOS end view resource multiplexing method, storage medium, equipment and system Active CN108334393B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810024350.XA CN108334393B (en) 2018-01-10 2018-01-10 iOS end view resource multiplexing method, storage medium, equipment and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810024350.XA CN108334393B (en) 2018-01-10 2018-01-10 iOS end view resource multiplexing method, storage medium, equipment and system

Publications (2)

Publication Number Publication Date
CN108334393A true CN108334393A (en) 2018-07-27
CN108334393B CN108334393B (en) 2021-11-26

Family

ID=62924688

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810024350.XA Active CN108334393B (en) 2018-01-10 2018-01-10 iOS end view resource multiplexing method, storage medium, equipment and system

Country Status (1)

Country Link
CN (1) CN108334393B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115344167A (en) * 2022-08-24 2022-11-15 北京字跳网络技术有限公司 Method, apparatus, device and medium for managing view unit
CN115708345A (en) * 2023-01-06 2023-02-21 山东捷瑞数字科技股份有限公司 UIScrollView-based pull-down interface dynamic display method in digital twin scene

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104035703A (en) * 2013-03-07 2014-09-10 腾讯科技(深圳)有限公司 Client side, method and system for changing view display
CN107479960A (en) * 2017-08-25 2017-12-15 广州优视网络科技有限公司 The display methods and device of a kind of cell view

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104035703A (en) * 2013-03-07 2014-09-10 腾讯科技(深圳)有限公司 Client side, method and system for changing view display
CN107479960A (en) * 2017-08-25 2017-12-15 广州优视网络科技有限公司 The display methods and device of a kind of cell view

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JAY张: ""UIscrollView 的子视图复用https://www.cnblogs.com/jayzhang/p/5105090.html"", 《博客园》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115344167A (en) * 2022-08-24 2022-11-15 北京字跳网络技术有限公司 Method, apparatus, device and medium for managing view unit
CN115708345A (en) * 2023-01-06 2023-02-21 山东捷瑞数字科技股份有限公司 UIScrollView-based pull-down interface dynamic display method in digital twin scene

Also Published As

Publication number Publication date
CN108334393B (en) 2021-11-26

Similar Documents

Publication Publication Date Title
CN107577533A (en) Resource allocation method and Related product
CN104484233B (en) A kind of resource allocation methods
CN106354562A (en) Memory cleaning system and memory cleaning method
CN110516703A (en) Vehicle identification method, device and storage medium based on artificial intelligence
CN107688789A (en) Document charts abstracting method, electronic equipment and computer-readable recording medium
CN108334393A (en) A kind of iOS end-views resource multiplexing method, storage medium, equipment and system
CN109703943A (en) Rubbish recovering method, client and garbage recycling bin
CN107679473A (en) Solve lock control method and Related product
CN111860522B (en) Identity card picture processing method, device, terminal and storage medium
CN110008997A (en) Image texture similarity recognition method, device and computer readable storage medium
CN111414916A (en) Method and device for extracting and generating text content in image and readable storage medium
CN104103045A (en) Gaussian blur processing method and system for terminal
CN110399812A (en) Face characteristic intelligent extract method, device and computer readable storage medium
CN106055404A (en) Method and device for cleaning up background application programs
CN112527506B (en) Device resource processing method and device, electronic device and storage medium
CN111641954B (en) Frequency point configuration method, device, equipment and storage medium
CN110825753B (en) Method for increasing positioning point capacity on webpage map
CN115049028B (en) Construction area partitioning method, system, terminal and medium based on unsupervised learning
CN106599889A (en) Method and apparatus for recognizing characters
CN105302628B (en) The moving method and device of a kind of virtual machine in base station resource pond
CN109189678A (en) A kind of webpage function verification method, computer readable storage medium and server
CN114494052A (en) Book counting method and device, computer equipment and storage medium
CN110233683B (en) AR edge computing resource scheduling method, system and medium
CN103606175B (en) The display packing of a kind of map hotspot icon and controller
CN106201784A (en) A kind of data back up method based on git and system

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