CN110489191A - The packaging method and device of the palace lattice view of calling easy of integration - Google Patents
The packaging method and device of the palace lattice view of calling easy of integration Download PDFInfo
- Publication number
- CN110489191A CN110489191A CN201910695052.8A CN201910695052A CN110489191A CN 110489191 A CN110489191 A CN 110489191A CN 201910695052 A CN201910695052 A CN 201910695052A CN 110489191 A CN110489191 A CN 110489191A
- Authority
- CN
- China
- Prior art keywords
- view
- palace
- lattice
- palace lattice
- oneself
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 66
- 230000010354 integration Effects 0.000 title claims abstract description 21
- 238000004806 packaging method and process Methods 0.000 title claims abstract description 21
- 230000004044 response Effects 0.000 claims abstract description 18
- 230000004048 modification Effects 0.000 claims description 8
- 238000012986 modification Methods 0.000 claims description 8
- 239000004744 fabric Substances 0.000 claims 1
- 230000008859 change Effects 0.000 description 4
- 238000012423 maintenance Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 2
- 238000010168 coupling process Methods 0.000 description 2
- 238000005859 coupling reaction Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000005538 encapsulation Methods 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
Abstract
The invention discloses a kind of packaging methods of the palace lattice view of calling easy of integration, include the following steps: A) it creates and makes container view by oneself;B creation palace lattice view in container view) is made by oneself described, and the container view of making by oneself is allowed to become commission and the data source agent of the palace lattice view;C principal method) is defined, definition code block encapsulates corresponding method and response events, relevant response event is passed by code block or way of bailment;D palace lattice configurationization attribute) is defined;E property setting method) is rewritten, dynamic calculates spacing between the lattice of palace, wide high and size, refreshes layout.The invention further relates to a kind of devices of the packaging method of palace lattice view for realizing above-mentioned calling easy of integration.The packaging method and device for implementing the palace lattice view of calling easy of integration of the invention have the advantages that and size of code are called more to simplify, and reduce controller pressure, and expansion is stronger, and for corresponding method event by block simplicity, legibility is stronger.
Description
Technical field
The present invention relates to view encapsulation field, in particular to the packaging method and dress of the palace lattice view of a kind of calling easy of integration
It sets.
Background technique
Traditional palace lattice view realization mode is with collectionView (palace lattice view) is directly added to controller
On view, related protocol is then abided by, delegate (commission) and dataSource (data source agent) are set, then realize correlation
Method, needs to calculate palace lattice size according to the picture of Gong Gezhong and text composition and spacing, and size of code is many and very
It is scattered, it is placed in controller, greatly increases the heavy of controller, be not easy to read, later maintenance is expanded at high cost.
Specifically, the implementation process of traditional palace lattice viewpoint is as follows: creation collectionView-> setting
Delegate, dataSource-> according to interval calculation Gong Gekuan high or according to interval-between wide high calculating palace lattice > are realized
Delegate, dataSource method-> completion.Traditional approach is that the related proxy method of collectionView is all put
In the controller, setting delegate, dataSource is directly controller;Be arranged collectionView palace lattice size,
Spacing, line number, columns between the lattice of palace require when use every time by detailed calculating;For the later period to palace lattice demand
Change, make change accordingly it is bigger.
Summary of the invention
The technical problem to be solved in the present invention is that in view of the above drawbacks of the prior art, providing a kind of calling size of code
It more simplifies, reduces controller pressure, expansion is stronger, and for corresponding method event by block simplicity, legibility is stronger
The packaging method of the palace lattice view of calling easy of integration.
The technical solution adopted by the present invention to solve the technical problems is: constructing a kind of palace lattice view of calling easy of integration
Packaging method includes the following steps:
A) container view is made in creation by oneself;
B creation palace lattice view in container view) is made by oneself described, allows the container view of making by oneself as the palace lattice
The commission of view and data source agent;
C principal method) is defined, definition code block encapsulates corresponding method and response events, relevant response event is passed through
Code block or way of bailment pass;
D palace lattice configurationization attribute) is defined;
E property setting method) is rewritten, dynamic calculates spacing between the lattice of palace, wide high and size, refreshes layout.
In the packaging method of the palace lattice view of calling easy of integration of the present invention, the attribute include line number, columns,
Spacing and data source array between palace lattice left and right margins, palace lattice.
In the packaging method of the palace lattice view of calling easy of integration of the present invention, in the step E) in, modify palace
Between lattice after spacing, the size of palace lattice is directly gone out according to distance computation between the palace lattice, it is then automatic to refresh layout.
The invention further relates to a kind of devices of the packaging method of palace lattice view for realizing above-mentioned calling easy of integration, comprising:
It makes container view creating unit by oneself: making container view by oneself for creating;
Palace lattice view creating unit: it for making creation palace lattice view in container view by oneself described, allows described customed
Container view becomes commission and the data source agent of the palace lattice view;
Event definition unit: for defining principal method, definition code block encapsulates corresponding method and response events, by phase
Response events are closed to pass by code block or way of bailment;
Attribute definition unit: for defining palace lattice configurationization attribute;
Attribute rewriting unit: for rewriteeing property setting method, dynamic calculates spacing between the lattice of palace, wide high and size, brush
New layout.
In device of the present invention, the attribute includes line number, columns, palace lattice left and right margins, spacing between the lattice of palace
With data source array.
In device of the present invention, in the attribute rewriting unit, modify between the lattice of palace after spacing, direct basis
Distance computation goes out the size of palace lattice between the palace lattice, then automatic to refresh layout.
The packaging method and device for implementing the palace lattice view of calling easy of integration of the invention, have the advantages that by
Container view is made by oneself in creation;Lattice view in palace is created in making container view by oneself, is allowed and is made container view by oneself as palace lattice
The commission of view and data source agent;Principal method is defined, definition code block encapsulates corresponding method and response events, will be related
Response events are passed by code block or way of bailment;Define palace lattice configurationization attribute;Rewrite property setting method, dynamic
Spacing between the lattice of palace, wide high and size are calculated, layout is refreshed;Palace lattice view is directly used compared to most original, calls size of code more
Add and simplify, reduces controller pressure, reach lower coupling, high cohesion;Secondly, expansion is strong in terms of later maintenance, can pass through
Modify attribute value directly to change, corresponding method event keeps legibility stronger, therefore tune of the present invention by block simplicity
It is more simplified with size of code, reduces controller pressure, expansion is stronger, and corresponding method event passes through block simplicity, readability
Property is stronger.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is the process of method in the packaging method and device one embodiment of the palace lattice view of present invention calling easy of integration
Figure;
Fig. 2 is the structural schematic diagram of device in the embodiment.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
In the packaging method and Installation practice of the palace lattice view of present invention calling easy of integration, the palace of calling easy of integration
The flow chart of the packaging method of lattice view is as shown in Figure 1.In Fig. 1, the packaging method of the palace lattice view of the calling easy of integration includes
Following steps:
Container view is made in step S01 creation by oneself: in this step, container view view is made in creation by oneself, by customed
Container view view adds and manages sub- view, and such as palace lattice view collectionView is added to and makes container view by oneself
On view.Palace lattice view collectionView can be nine grids, 12 palace lattice etc..
Step S02 creates palace lattice view in making container view by oneself, allows and makes container view by oneself as palace lattice view
Commission and data source agent: in this step, creating palace lattice view collectionView in making container view view by oneself,
Exactly traditional palace lattice view collectionView is added to and is made by oneself in container view view, allows and makes container view by oneself
View becomes the commission delegate and data source agent dataSource of palace lattice view.
Delegate is a kind of commission, is a part of thing that class oneself is needed to do, and allows another class (can also be with
It is exactly oneself itself) it completes.Data source agent dataSource is used to be arranged the data of palace lattice view collectionView,
Exist with array form.
Step S03 defines principal method, and definition code block encapsulates corresponding method and response events, by relevant response event
It is passed by code block or way of bailment: in this step, definition commission delegate method, definition code block block envelope
Corresponding method and response events are filled, all related proxy methods and data source method, which are all placed on, to be made by oneself in container view
Then view is passed relevant response event by code block block or commission delegate mode.Above-mentioned code block
Block is usually used in GCD, animation, sequence and all kinds of readjustments for realizing the characteristic of anonymous function.
Step S04 defines palace lattice configurationization attribute: in this step, defining palace lattice configurationization attribute, attribute includes line number
Row, columns column, palace lattice left and right margins wideGap, spacing itemGap and data source array dataSource between the lattice of palace.
Step S05 rewrites property setting method, and dynamic calculates spacing between the lattice of palace, wide high and size, refreshes layout: this step
In rapid, rewrite attribute and set method is set, dynamic calculates spacing between the lattice of palace, wide high and size, and refreshes layout.By direct
Then modification attribute refreshes layout, can dynamically modify or switch spacing, line number, columns, palace between palace lattice size, palace lattice in real time
Lattice content etc..
Palace lattice view collectionView is directly used compared to traditional most original, calls size of code more to simplify, reduces
Controller pressure reaches lower coupling, high cohesion.Secondly, expansion is strong in terms of later maintenance, it can be by directly modifying category
Property value changes.Such as: between modification palace lattice after spacing (interval), the big of palace lattice directly can be gone out according to distance computation between the lattice of palace
It is small, it is then automatic to refresh layout.For another example: the size dimension of modification palace lattice will automatically calculate spacing between the lattice of palace and then refresh,
Or spacing calculates the size and width height of palace lattice automatically between modification palace lattice, then refreshes layout.Corresponding method event passes through generation
Code block block simplicity, keeps legibility stronger.
The present embodiment further relates to a kind of device of the packaging method of palace lattice view for realizing above-mentioned calling easy of integration, the device
Structural schematic diagram it is as shown in Figure 2.In Fig. 2, which includes making container view creating unit 1, palace lattice view creation list by oneself
Member 2, event definition unit 3, attribute definition unit 4 and attribute rewriting unit 5;Wherein, the use of container view creating unit 1 is made by oneself
Container view view is made by oneself in creation;Palace lattice view creating unit 2 is used to create palace lattice in making container view view by oneself
View collectionView, allow make by oneself container view view become palace lattice view commission delegate and data source agent
dataSource;Event definition unit 3 is for defining commission delegate method, the corresponding side of definition code block block encapsulation
Method and response events pass relevant response event by code block block or commission delegate mode.Attribute definition
Unit 4 is for defining palace lattice configurationization attribute;Attribute includes line number row, columns column, palace lattice left and right margins wideGap, palace
Spacing itemGap and data source array dataSource between lattice.
Attribute rewriting unit 5 calculates spacing between the lattice of palace, wide high and size, brush for rewriteeing property setting method, dynamic
New layout.In the attribute rewriting unit 5, between modification palace lattice after spacing, palace lattice are directly gone out according to distance computation between the lattice of palace
Size, it is then automatic to refresh layout.
In practical applications, alternative solution can also be used.
Alternative solution 1: a customed view view encapsulates collectionView, this view is set as
The delegate and dataSource of collectionView.All relevant methods are placed on the delegate method that view is defined
In block.Line number, columns, spacing are come out by manual calculations.Manual refreshing after change layout.
Alternative solution 2: a customed view puts button in this view, and the realization of palace lattice passes through button's
Number carrys out typesetting, each button setting tag is marked, the click event of single palace lattice is exactly the click thing of single button
Part.Button is button, can be with clicking trigger event.
In short, the present invention is encapsulated in the event of palace lattice view collectionView the generation for making container view view by oneself
In code block block, pass through code block block call method;All configurations of palace lattice in the lattice view collectionView of palace
Attribute refreshes layout by rewriteeing the dynamic modification of set method.The present invention provides commission two kinds of sides delege and code block block
The response events of formula processing palace lattice view collectionView.The present invention calls size of code more to simplify, and reduces controller pressure
Power, expansion is stronger, and for corresponding method event by block simplicity, legibility is stronger.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in essence of the invention
Within mind and principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.
Claims (6)
1. a kind of packaging method of the palace lattice view of calling easy of integration, which comprises the steps of:
A) container view is made in creation by oneself;
B creation palace lattice view in container view) is made by oneself described, allows the container view of making by oneself as the palace lattice view
Commission and data source agent;
C principal method) is defined, definition code block encapsulates corresponding method and response events, relevant response event is passed through code
Block or way of bailment pass;
D palace lattice configurationization attribute) is defined;
E property setting method) is rewritten, dynamic calculates spacing between the lattice of palace, wide high and size, refreshes layout.
2. the packaging method of the palace lattice view of calling easy of integration according to claim 1, which is characterized in that the attribute packet
Include line number, columns, palace lattice left and right margins, spacing and data source array between the lattice of palace.
3. the packaging method of the palace lattice view of calling easy of integration according to claim 2, which is characterized in that in the step
E in), between modification palace lattice after spacing, the size of palace lattice is directly gone out according to distance computation between the palace lattice, it is then automatic to refresh
Layout.
4. a kind of device of the packaging method for the palace lattice view for realizing calling easy of integration as described in claim 1, feature exist
In, comprising:
It makes container view creating unit by oneself: making container view by oneself for creating;
Palace lattice view creating unit: it for making in container view creation palace lattice view by oneself described, allows and described makes container by oneself
View becomes commission and the data source agent of the palace lattice view;
Event definition unit: for defining principal method, definition code block encapsulates corresponding method and response events, and correlation is rung
Event is answered to pass by code block or way of bailment;
Attribute definition unit: for defining palace lattice configurationization attribute;
Attribute rewriting unit: for rewriteeing property setting method, dynamic calculates spacing between the lattice of palace, wide high and size, refreshes cloth
Office.
5. device according to claim 4, which is characterized in that the attribute include line number, columns, palace lattice left and right margins,
Spacing and data source array between the lattice of palace.
6. device according to claim 5, which is characterized in that in the attribute rewriting unit, between modifying between the lattice of palace
Away from rear, the size of palace lattice is directly gone out according to distance computation between the palace lattice, it is then automatic to refresh layout.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910695052.8A CN110489191A (en) | 2019-07-30 | 2019-07-30 | The packaging method and device of the palace lattice view of calling easy of integration |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910695052.8A CN110489191A (en) | 2019-07-30 | 2019-07-30 | The packaging method and device of the palace lattice view of calling easy of integration |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110489191A true CN110489191A (en) | 2019-11-22 |
Family
ID=68548683
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910695052.8A Pending CN110489191A (en) | 2019-07-30 | 2019-07-30 | The packaging method and device of the palace lattice view of calling easy of integration |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110489191A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2001029643A1 (en) * | 1999-10-22 | 2001-04-26 | Appcity Inc. | Method and system for encapsulating an application program |
CN103399691A (en) * | 2013-08-07 | 2013-11-20 | 浙江宇天科技股份有限公司 | Method and device for loading and displaying data |
CN107329795A (en) * | 2017-06-23 | 2017-11-07 | 北京酷我科技有限公司 | A kind of TableView optimization methods |
CN108415703A (en) * | 2018-02-08 | 2018-08-17 | 武汉斗鱼网络科技有限公司 | A kind of quick interface arrangement method, device, electronic equipment and storage medium |
-
2019
- 2019-07-30 CN CN201910695052.8A patent/CN110489191A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2001029643A1 (en) * | 1999-10-22 | 2001-04-26 | Appcity Inc. | Method and system for encapsulating an application program |
CN103399691A (en) * | 2013-08-07 | 2013-11-20 | 浙江宇天科技股份有限公司 | Method and device for loading and displaying data |
CN107329795A (en) * | 2017-06-23 | 2017-11-07 | 北京酷我科技有限公司 | A kind of TableView optimization methods |
CN108415703A (en) * | 2018-02-08 | 2018-08-17 | 武汉斗鱼网络科技有限公司 | A kind of quick interface arrangement method, device, electronic equipment and storage medium |
Non-Patent Citations (2)
Title |
---|
再见远洋: "几个宏设置搞定九宫格布局", 《简书》 * |
翻滚着的牛宝宝: "iOS 使用UICollectionView封装实现卡片式View", 《简书》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11373346B1 (en) | Animated transitions between graphs | |
CN105512139B (en) | The implementation method and device of data visualization | |
CN110110174B (en) | Data visualization page generation, monitoring and display method, browser and server | |
CN103218197B (en) | A kind of methods, devices and systems of Dynamic Announce data | |
CN109597614A (en) | A kind of business page method for customizing and system | |
CN105446740A (en) | MVVM (Model-View-View Model) architecture based Web front-end presentation system | |
CN109697064A (en) | A kind of generation method and device of the customized page | |
CN102360377B (en) | Spatial clustering mining PSE (Problem Solving Environments) system and construction method thereof | |
KR970017053A (en) | 3-D real-time monitoring of attributes of processing | |
CN108512879A (en) | A kind of information-pushing method and device | |
CN103677789A (en) | Table data displaying method and system based on GRID assembly | |
CN109032586A (en) | A kind of data visualization method and device | |
KR20210094003A (en) | Data processing methods and devices, devices, servers, systems and storage media | |
CN105635464A (en) | Message processing method and apparatus | |
CN105512099A (en) | Gantt chart generation method and device | |
CN106294463A (en) | The data point update method of a kind of performance graph and equipment | |
CN110109423B (en) | Water power plant real-time data monitoring system based on Html5 technology | |
US10289388B2 (en) | Process visualization toolkit | |
CN110990431A (en) | Method for realizing synchronous linkage carousel of China map and line graph data | |
CN110443880A (en) | Image rendering method, device, storage medium and electronic equipment | |
CN106201461A (en) | Generation method, system and the background server at a kind of interface | |
CN114780077A (en) | Webpage visual editing device and method | |
CN110489191A (en) | The packaging method and device of the palace lattice view of calling easy of integration | |
US8635541B2 (en) | Indicating pending asynchronous updates in a graphical user interface (GUI) | |
CN110781653B (en) | Method, device, computer equipment and storage medium for drawing svg chart by using vue |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20191122 |