iOS-based card-style list display methods, devices, media, and equipment
By using card reuse technology, the problem of excessive CPU and memory consumption in iOS card-style lists has been solved, resulting in a better user experience.
Patent Information
- Application Number
- CN202210971597.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-12
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2042-08-12
AI Technical Summary
Existing implementations of card-style lists for iOS have issues with CPU and memory consumption, leading to device lag and a poor user experience.
By using card reuse technology, it is determined whether the current card type matches the target data type. If they match, the card is used directly; otherwise, it is cached or a new card is created, reducing the number of card creations and lowering CPU and memory consumption.
This effectively reduces the number of card creations, decreases CPU consumption and memory usage, and improves the user experience.
Smart Images

Figure CN115269104B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of iOS development technology, and more specifically, to a method, apparatus, medium, and device for displaying a card-style list based on iOS. Background Technology
[0002] In iOS client development, there is no native view for card-style lists, and Apple has not provided a similar solution, so developers need to implement each function themselves.
[0003] iOS card-based lists often feature multiple layered views stacked vertically. Existing card-based list implementations address whether to destroy or cache cards removed from the screen. However, these solutions suffer from several problems: destroying cards upon removal places a significant burden on the CPU, especially in scenarios with a large number of cards (e.g., 10 or 20 cards), requiring substantial resources to create and stack these cards for display. Cached cards after removal, on the other hand, accumulates rapidly and consumes a large amount of memory.
[0004] Therefore, in existing technologies, the implementation of iOS card-style lists has difficulty in handling excessive CPU usage and memory consumption. Such applications may cause lag on the device and result in a poor user experience. Summary of the Invention
[0005] The purpose of this application is to provide a method, apparatus, medium and device for displaying a card-style list based on iOS, so as to effectively reduce the number of times cards are created through card reuse technology, and greatly reduce CPU consumption and memory occupied by cached cards.
[0006] To achieve the above objectives, the embodiments of this application are implemented in the following manner:
[0007] In a first aspect, embodiments of this application provide a method for displaying a card-style list based on iOS, comprising: obtaining a card switching instruction, and removing the current card in the card display area based on the card switching instruction, and displaying the next card, wherein x cards are stacked in the card display area; determining the target data currently ranked first from a pre-acquired data sequence, and determining the data type of the target data, wherein the data sequence contains y data items to be displayed, and each data item to be displayed has a corresponding data type; determining whether the card type of the removed current card corresponds to the data type of the target data; if they correspond, determining the removed current card as the target card unit; if they do not correspond, placing the removed current card into a cache pool for caching, and determining the target card unit whose card type corresponds to the data type of the target data from the cache pool, wherein the cache pool stores cards of multiple card types; updating the target data to the target card unit to obtain a card to be displayed, placing the card to be displayed at the bottom layer of the card display area, and deleting the target data from the data sequence.
[0008] In this embodiment, the current card in the card display area (containing x stacked cards) is removed to display the next card. The target data, currently ranked first, is determined from a pre-acquired data sequence (containing y data items to be displayed), and its data type is also determined. Then, it is determined whether the card type of the removed current card corresponds to the data type of the target data. If they correspond, the removed current card is identified as the target card unit (which can be understood as a card template, with different types of card templates). If they do not correspond, the removed current card is cached in a cache pool, and a target card unit whose card type matches the data type of the target data is identified from the cache pool. The target data is then updated to the target card unit, resulting in a card to be displayed. This card is then placed at the bottom layer of the card display area, and the target data is deleted from the data sequence. This method enables card reuse. If the removed current card meets the conditions (type matching), it can be directly used (as the target card unit); if it does not meet the conditions (type mismatch), it can be cached in the cache pool for later use. This approach eliminates the need to create new cards once the target card unit is identified. Card creation only occurs when the current card does not meet the criteria and there are no matching cards in the cache pool, effectively reducing the number of card creations. Furthermore, the cache pool only needs to cache a small number of cards (no more than x cards of each type) to satisfy all application scenarios, significantly reducing the memory usage of cached cards. Therefore, this solution effectively addresses the issues of excessive CPU and memory consumption faced by card-based list implementations, improving the user experience.
[0009] In conjunction with the first aspect, in the first possible implementation of the first aspect, determining the target card unit whose card type corresponds to the data type of the target data from the cache pool includes: determining whether there is a card in the cache pool whose card type corresponds to the data type of the target data; if there is, determining this card as the target card unit; if there is no card, creating a card whose card type corresponds to the data type of the target data and putting it into the cache pool, and then determining this card as the target card unit from the cache pool.
[0010] In conjunction with the first aspect, in the second possible implementation of the first aspect, before obtaining the card switching instruction, the method further includes: creating a card list view as a card display area; creating a parent card, wherein the parent card has basic elements and basic controls; obtaining a data sequence, wherein the data sequence contains y pieces of data to be displayed, and each piece of data to be displayed has a corresponding data type; for the target data currently ranked first in the data sequence, determining the data type of the target data, creating a child card that inherits from the parent card, and adding personalized controls to this child card based on the data type of the target data, obtaining a target card unit whose card type corresponds to the data type of the target data, then adding the target data to this target card unit to obtain a card to be displayed, then deleting the target data from the data sequence, and placing this card to be displayed at the bottom layer of the card list view, until x cards to be displayed are added to the card list view; and displaying the topmost card to be displayed in the card list view.
[0011] In this implementation, the basic structure of a card-based list can be built. After creating sub-cards, adding personalized controls yields the corresponding target card unit, which in turn adds target data to create the card to be displayed. Initially, the cache pool contains few cards of relatively limited types. As the card-based list runs longer and the number of displayed cards increases, the cache pool becomes richer. When the cache pool contains nx cards (where n is the number of card types and x is the number of cards stacked in the display area), it can handle all scenarios without needing to create new cards.
[0012] In conjunction with the second possible implementation of the first aspect, the third possible implementation of the first aspect involves creating a parent card as follows: creating a parent card cell; adding a pan gesture to the parent card cell to control the card to transform when the user swipes the card; determining whether the transform has reached a set size when the user stops swiping and leaves the touch point to decide whether to remove the card; and adding a card removal animation to the parent card cell to play when the card moves off the screen.
[0013] In this implementation, a parent card is created in this way, and common basic elements (such as card removal animations) and basic controls (such as swipe gestures) can be added to it, which facilitates the creation of subsequent child cards.
[0014] In conjunction with the third possible implementation of the first aspect, in the fourth possible implementation of the first aspect, determining whether the transform deformation reaches the set size to determine whether to remove the card includes: determining whether the transform deformation reaches half of the screen size; if the transform deformation reaches half of the screen size, generating a card switching instruction; if the transform deformation does not reach half of the screen size, restoring the card.
[0015] In conjunction with the second possible implementation of the first aspect, in the fifth possible implementation of the first aspect, after deleting the target data from the data sequence, the method further includes: detecting the remaining number of data to be displayed in the data sequence; when the remaining number is less than z, pulling new data to be displayed and listing it at the end of the data sequence to supplement the number of data to be displayed in the data sequence to y.
[0016] In this implementation, the amount of data to be displayed in the data sequence can be replenished in a timely manner.
[0017] Combining the fifth possible implementation of the first aspect, in the sixth possible implementation of the first aspect, x = 4, y ≤ 20, z ∈ [0, 16].
[0018] Secondly, embodiments of this application provide a card-style list display device based on iOS, comprising: a card switching module, configured to acquire a card switching instruction, and remove the current card in the card display area based on the card switching instruction, and display the next card, wherein x cards are stacked in the card display area; a target data determination module, configured to determine the target data currently sorted first from a pre-acquired data sequence, and determine the data type of the target data, wherein the data sequence contains y data items to be displayed, and each data item to be displayed has a corresponding data type; a judgment module, configured to determine whether the card type of the removed current card corresponds to the data type of the target data; and a target card unit determination module. The module is used to determine that the removed current card is the target card unit when the card type of the removed current card corresponds to the data type of the target data; and to place the removed current card into a cache pool for caching when the card type of the removed current card does not correspond to the data type of the target data, and to determine the target card unit whose card type corresponds to the data type of the target data from the cache pool, wherein the cache pool stores cards of multiple card types; the card to be displayed generation module is used to update the target data to the target card unit to obtain a card to be displayed, place the card to be displayed at the bottom layer of the card display area, and delete the target data from the data sequence.
[0019] Thirdly, embodiments of this application provide a storage medium including a stored program, wherein, when the program is running, it controls the device where the storage medium is located to execute any one of the first aspects or possible implementations of the first aspect, the iOS-based card list display method.
[0020] Fourthly, embodiments of this application provide an electronic device, including a memory and a processor. The memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions. When the program instructions are loaded and executed by the processor, they implement the iOS-based card list display method as described in any one of the first aspects or possible implementations of the first aspect.
[0021] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0022] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a structural block diagram of an electronic device provided in an embodiment of this application.
[0024] Figure 2 A flowchart illustrating an iOS-based card-style list display method provided in an embodiment of this application.
[0025] Figure 3 This is a screenshot showing how a card-style list can be implemented on a webpage.
[0026] Figure 4 A layout hierarchy diagram of the page to achieve the effect of a card-style list.
[0027] Figure 5 A structural block diagram of an iOS-based card-style list display device provided in an embodiment of this application.
[0028] Icons: 10-Electronic device; 11-Memory; 12-Communication module; 13-Bus; 14-Processor; 20-iOS-based card-style list display device; 21-Card switching module; 22-Target data determination module; 23-Judgment module; 24-Target card unit determination module; 25-Card to be displayed generation module. Detailed Implementation
[0029] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0030] In this embodiment, the iOS-based card list display method can be applied to electronic devices (such as smartphones, tablets, etc.). The electronic devices are equipped with the iOS system and can execute the iOS-based card list display method.
[0031] Please see Figure 1 , Figure 1 This is a structural block diagram of an electronic device 10 provided in an embodiment of this application.
[0032] For example, electronic device 10 may include: a communication module 12 connected to the outside world via a network, one or more processors 14 for executing program instructions, a bus 13, and different forms of memory 11, such as disk, ROM, or RAM, or any combination thereof. Electronic device 10 also has a display screen for displaying cards. The memory 11, communication module 12, and processor 14 can be connected via the bus 13.
[0033] For example, memory 11 stores programs. Processor 14 can call and run these programs from memory 11, thereby enabling an iOS-based card-style list display method by running the programs.
[0034] Please see Figure 2 , Figure 2 This is a flowchart illustrating a method for displaying a card-style list based on iOS, provided in an embodiment of this application. In this embodiment, the method for displaying a card-style list based on iOS may include steps S10, S20, S30, S40, and S50.
[0035] To facilitate understanding, before introducing step S10, the process of constructing the card list will be introduced here first.
[0036] In this embodiment, a card list view can be created first as a card display area. The card list view can be used to store and manage each card.
[0037] Then, a parent card can be created, which contains basic elements and controls. For example, a parent card can be created as follows:
[0038] Create a parent card cell and add a swipe gesture to the parent card cell to control the card to transform as the user swipes. When the user stops swiping and leaves the touch point, determine whether the transform has reached a set size (e.g., half the screen size) to decide whether to remove the card.
[0039] For example, it can determine whether the transform has scrolled beyond half the screen size. If the transform reaches half the screen size, a card switching command can be generated for subsequent card switching. If the transform does not reach half the screen size, the card can be restored.
[0040] You can also add card removal animations to the parent class's card cells, which play when the card moves off-screen.
[0041] Creating a parent card in this way allows you to add common basic elements (such as card removal animations) and basic controls (such as pan gestures) to it, making it easier to create subsequent child cards.
[0042] After creating a parent card, you can then create child cards based on it. Since the creation of child cards depends on the data type (e.g., there are multiple types of data to be displayed, such as images, text, and videos), different data types may require different card types to carry and display them. Therefore, before creating personalized child cards, you need to first determine the data type of the data to be displayed (i.e., the data type of the data to be displayed).
[0043] For example, a data sequence can be obtained, which contains y data items to be displayed, and each data item to be displayed has a corresponding data type.
[0044] For the target data that is currently ranked first in the data sequence, we can determine its data type. Then, we can create a child card that inherits from the parent card and add personalized controls to this child card based on the data type of the target data. For example, for a child card containing video data, we need to add control A to ensure video playback; for a child card containing image data, we can add control B to facilitate image display and manipulation.
[0045] After creating the sub-card, you can put it into the cache pool, and then determine the card from the cache pool as the target card unit corresponding to the target data (the data type of the target data corresponds to the card type of the target card unit).
[0046] After obtaining the target card unit corresponding to the card type and the data type of the target data, the target data can be added to this target card unit to obtain a card to be displayed. Then, the target data is deleted from the data sequence, and the order of the remaining data to be displayed in the data sequence is adjusted accordingly. For example, the original second data item is now first, and so on.
[0047] Then, the cards to be displayed can be placed at the bottom of the card list view (their size and position can be adjusted; each new card added to the card list view will be placed at the bottom), until x cards are added to the card list view. After that, the topmost card in the card list view can be displayed.
[0048] It should be noted that since each generation of a card to be displayed requires "consuming" one piece of data to be displayed, and the data to be displayed in the data sequence does not need to be updated in real time (real-time update: one piece is added after each one is consumed), it can be updated in stages (after consuming a certain number of data to be displayed, it is replenished again until a fixed number is reached, for example, every 10 pieces of data are consumed, it is replenished once until 20 pieces are reached). Therefore, the number of data to be displayed y' in the data sequence can have different values at different times (for example, the first time, y' = 20, the second time, y' = 19, the third time, y' = 18, ... the tenth time, y' = 11, the eleventh time, the data sequence is replenished with 20 pieces, y' = 20), which is not limited here.
[0049] Specifically, after deleting the target data from the data sequence, the remaining number of data items to be displayed in the data sequence can be detected. When the remaining number is less than z items (e.g., 11 items), new data items to be displayed can be retrieved and added to the end of the existing data sequence to supplement the number of data items to be displayed in the data sequence to y items (e.g., y=20). This can replenish the number of data items to be displayed in the data sequence in a timely manner without the need for real-time replenishment, thus reducing resource consumption.
[0050] Furthermore, the possible values for x, y, and z are: x = 4, y ≤ 20, z ∈ [0, 16]. The examples of x, y, and z being x = 4, y = 20, and z = 11 respectively should not be considered as limitations on this application.
[0051] This approach forms the foundation for a card-based list system. After creating sub-cards, adding personalized controls yields the corresponding target card units, which in turn allow you to add target data to create the cards to be displayed. Initially, the cache pool contains a small number of cards of relatively limited types. As the card-based list runs longer and the number of displayed cards increases, the cache pool becomes richer. Once the cache pool contains nx cards (where n is the number of card types and x is the number of cards stacked in the display area), it can handle all scenarios without needing to create new cards.
[0052] To achieve the effect of a card-style list, as shown below. Figure 3 and Figure 4 As shown: Figure 3 A screenshot showing the effect of creating a card-style list on the page; Figure 4 A layout hierarchy diagram of the page to achieve the effect of a card-style list.
[0053] When the displayed card needs to be switched by the user, step S10 can be executed.
[0054] Step S10: Obtain a card switching instruction, and remove the current card in the card display area based on the card switching instruction, and display the next card, wherein x cards are stacked in the card display area.
[0055] In this embodiment, a card switching instruction generated based on the user's operation can be obtained (for the generation method of the card switching instruction, please refer to the previous introduction of the basic controls added to the parent class card). Based on the card switching instruction, the current card in the card display area is removed, and the next card is displayed. Here, x cards are stacked in the card display area.
[0056] Then, step S20 can be performed.
[0057] Step S20: Determine the target data that is currently ranked first from the pre-acquired data sequence, and determine the data type of the target data, wherein the data sequence contains y data items to be displayed, and each data item to be displayed has a corresponding data type.
[0058] In this embodiment, the target data currently ranked first can be determined from a pre-acquired data sequence, and the data type of the target data can also be determined. The data sequence contains y data items to be displayed, and each data item to be displayed has a corresponding data type.
[0059] Once the data type of the target data is determined, step S30 can be executed.
[0060] Step S30: Determine whether the card type of the removed current card corresponds to the data type of the target data.
[0061] In this embodiment, the card type of the currently removed card can be determined, and the card type of the current card can be compared with the data type of the target data to determine whether the two types correspond.
[0062] Based on the comparison result between the current card type and the target data type, step S40 can be executed.
[0063] Step S40: If they correspond, determine that the removed current card is the target card unit; if they do not correspond, put the removed current card into the cache pool for caching, and determine the target card unit whose card type corresponds to the data type of the target data from the cache pool. The cache pool stores cards of multiple card types.
[0064] In this embodiment, if the card type of the current card corresponds to the data type of the target data, the current card to be removed can be determined as the target card unit. Since the card type of the current card corresponds to the data type of the target data, there is no need to search for the corresponding card in the cache pool as the target card unit. Instead, the current card is directly used as the target card unit, which not only saves the process of searching for the card in the cache pool, but also saves the process of placing the current card into the cache pool.
[0065] If the card type of the current card does not correspond to the data type of the target data, the removed current card needs to be placed into the cache pool for caching, and the target card unit corresponding to the card type and data type of the target data needs to be determined from the cache pool. The cache pool stores cards of various card types.
[0066] For example, the method for determining the target card unit corresponding to the card type and the data type of the target data from the cache pool can be as follows: determine whether there is a card in the cache pool whose card type corresponds to the data type of the target data; if there is, this card can be directly determined as the target card unit; if there is no card, a card whose card type corresponds to the data type of the target data needs to be created, then put into the cache pool, and then the newly created card is determined as the target card unit from the cache pool.
[0067] Once the target card unit is identified, step S50 can be executed.
[0068] Step S50: Update the target data to the target card unit to obtain a card to be displayed, place the card to be displayed at the bottom layer of the card display area, and delete the target data from the data sequence.
[0069] In this embodiment, target data can be updated to the target card unit to obtain a card to be displayed, thereby placing the card to be displayed at the bottom layer of the card display area. Since the current card is cut out, the number of cards in the card display area becomes x-1. After placing the card to be displayed at the bottom layer of the card display area, the number of cards in the card display area becomes x, and the layer changes accordingly.
[0070] Next, the target data can be deleted from the data sequence, and the sorting of the remaining data to be displayed in the data sequence can be adjusted accordingly. This process continues until the number of remaining data items to be displayed in the data sequence is less than z, at which point data is fetched to supplement the data sequence.
[0071] The process involves removing the current card from the card display area (containing x stacked cards) and displaying the next card. The first target data in the current order is determined from a pre-acquired data sequence (containing y data items to be displayed), and its data type is also determined. Then, it's checked whether the card type of the removed current card matches the data type of the target data. If they match, the removed current card is designated as the target card unit (which can be understood as a card template with different types). If they don't match, the removed current card is cached in a cache pool, and a target card unit matching the target data type is identified from the cache pool. The target data is then updated to the target card unit, resulting in a card to be displayed. This card is then placed at the bottom of the card display area, and the target data is removed from the data sequence. This method enables card reuse; if the removed current card meets the condition (type matching), it can be directly used (as the target card unit); if it doesn't meet the condition (type mismatch), it can be cached in the cache pool for later use. This approach eliminates the need to create new cards once the target card unit is identified. Card creation only occurs when the current card does not meet the criteria and there are no matching cards in the cache pool, effectively reducing the number of card creations. Furthermore, the cache pool only needs to cache a small number of cards (no more than x cards of each type) to satisfy all application scenarios, significantly reducing the memory usage of cached cards. Therefore, this solution effectively addresses the issues of excessive CPU and memory consumption faced by card-based list implementations, improving the user experience.
[0072] Based on the same inventive concept, this application provides an iOS-based card-style list display device 20. Please refer to... Figure 5 The iOS-based card-style list display device 20 may include:
[0073] The card switching module 21 is used to obtain a card switching instruction and remove the current card in the card display area based on the card switching instruction, and display the next card, wherein x cards are stacked in the card display area.
[0074] The target data determination module 22 is used to determine the target data that is currently ranked first from the pre-acquired data sequence, and to determine the data type of the target data, wherein the data sequence contains y data items to be displayed, and each data item to be displayed has a corresponding data type.
[0075] The judgment module 23 is used to determine whether the card type of the removed current card corresponds to the data type of the target data.
[0076] The target card unit determination module 24 is used to determine the removed current card as the target card unit when the card type of the removed current card corresponds to the data type of the target data; and to place the removed current card into a cache pool for caching when the card type of the removed current card does not correspond to the data type of the target data, and to determine the target card unit whose card type corresponds to the data type of the target data from the cache pool, wherein the cache pool stores cards of multiple card types.
[0077] The card to be displayed generation module 25 is used to update the target data to the target card unit to obtain a card to be displayed, place the card to be displayed at the bottom layer of the card display area, and delete the target data from the data sequence.
[0078] In this embodiment, the target card unit determination module 24 is specifically used to determine whether there is a card in the cache pool whose card type corresponds to the data type of the target data; if there is, determine that this card is the target card unit; if there is no card, create a card whose card type corresponds to the data type of the target data and put it into the cache pool, and then determine that this card is the target card unit from the cache pool.
[0079] In this embodiment, the iOS-based card-style list display device 20 further includes an initial construction module, used to create a card list view as a card display area before the card switching module 21 obtains the card switching instruction; create a parent card, wherein the parent card is equipped with basic elements and basic controls; obtain a data sequence, wherein the data sequence contains y pieces of data to be displayed, and each piece of data to be displayed has a corresponding data type; for the target data currently ranked first in the data sequence, determine the data type of the target data, create a child card that inherits from the parent card, and add personalized controls to this child card based on the data type of the target data, obtain a target card unit whose card type corresponds to the data type of the target data, then add the target data to this target card unit to obtain a card to be displayed, then delete the target data from the data sequence, and place this card to be displayed at the bottom layer of the card list view, until x cards to be displayed are added to the card list view; and display the topmost card to be displayed in the card list view.
[0080] In this embodiment, the initial construction module is specifically used to create a parent card cell; add a swipe gesture pan Gesture to the parent card cell to control the card to transform when the user swipes the card; when the user stops swiping and leaves the touch point, determine whether the transform has reached the set size to determine whether to remove the card; add a card removal animation to the parent card cell to play when the card moves off the screen.
[0081] In this embodiment, the initial construction module is specifically used to determine whether the transform deformation reaches half of the screen size; if the transform deformation reaches half of the screen size, a card switching instruction is generated; if the transform deformation does not reach half of the screen size, the card is restored.
[0082] In this embodiment, the iOS-based card list display device 20 further includes a data sequence completion module, which is used to detect the remaining number of data to be displayed in the data sequence after the target data is deleted from the data sequence by the card generation module 25; when the remaining number is less than z, new data to be displayed is pulled and listed at the end of the data sequence to supplement the number of data to be displayed in the data sequence to y.
[0083] This application embodiment also provides a storage medium, the storage medium including a stored program, wherein, when the program is running, it controls the device where the storage medium is located to execute any one of the first aspects or possible implementations of the first aspect, the iOS-based card list display method.
[0084] In summary, this application provides a method, apparatus, medium, and device for displaying a card-style list based on iOS. The method involves removing the current card from a card display area (containing x stacked cards) and displaying the next card. The first target data in the current order is determined from a pre-acquired data sequence (containing y data items to be displayed), and the data type of the target data is also determined. Then, it is determined whether the card type of the removed current card corresponds to the data type of the target data. If they correspond, the removed current card is identified as the target card unit (which can be understood as a card template, with different types of card templates). If they do not correspond, the removed current card is cached in a cache pool, and a target card unit whose card type corresponds to the data type of the target data is identified from the cache pool. The target data is then updated to the target card unit to obtain a card to be displayed. This card is then placed at the bottom layer of the card display area, and the target data is deleted from the data sequence. This approach enables card reuse. If the removed current card meets the conditions (type matching), it can be directly used (as the target card unit); if it does not meet the conditions (type mismatch), it can be cached in a cache pool for later use. This approach eliminates the need to create new cards once the target card unit is identified. Card creation only occurs when the current card does not meet the criteria and there are no matching cards in the cache pool, effectively reducing the number of card creations. Furthermore, the cache pool only needs to cache a small number of cards (no more than x cards of each type) to satisfy all application scenarios, significantly reducing the memory usage of cached cards. Therefore, this solution effectively addresses the issues of excessive CPU and memory consumption faced by card-based list implementations, improving the user experience.
[0085] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed.
[0086] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.
[0087] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for displaying a card-style list based on iOS, characterized in that, include: Obtain a card switching instruction, and based on the card switching instruction, remove the current card in the card display area and display the next card, wherein x cards are stacked in the card display area; The target data that is currently ranked first is determined from the pre-acquired data sequence, and the data type of the target data is determined. The data sequence contains y data items to be displayed, and each data item to be displayed has a corresponding data type. Determine whether the card type of the currently removed card corresponds to the data type of the target data; If they match, the removed current card is identified as the target card unit; if they do not match, the removed current card is placed in the cache pool for caching, and the target card unit whose card type corresponds to the data type of the target data is identified from the cache pool. The cache pool stores cards of various card types. The target data is updated to the target card unit to obtain a card to be displayed. The card to be displayed is placed at the bottom layer of the card display area, and the target data is deleted from the data sequence.
2. The method for displaying a card-style list based on iOS according to claim 1, characterized in that, Determining the target card unit whose card type corresponds to the data type of the target data from the cache pool includes: Determine whether there are cards in the cache pool whose card type corresponds to the data type of the target data; If it exists, determine that this card is the target card unit; If it does not exist, create a card whose card type corresponds to the data type of the target data and put it into the cache pool, and then determine this card as the target card unit from the cache pool.
3. The method for displaying a card-style list based on iOS according to claim 1, characterized in that, Before obtaining the card switching instruction, the method further includes: Create a card list view as the card display area; Create a parent card, which contains basic elements and basic controls; Obtain a data sequence, wherein the data sequence contains y data items to be displayed, and each data item to be displayed has a corresponding data type; For the target data that is currently ranked first in the data sequence, determine the data type of the target data, create a child card that inherits from the parent card, and add personalized controls to the child card based on the data type of the target data to obtain the target card unit whose card type corresponds to the data type of the target data. Then, add the target data to the target card unit to obtain a card to be displayed. Then, delete the target data from the data sequence and place the card to be displayed at the bottom layer of the card list view until x cards to be displayed are added to the card list view. Display the topmost card in the card list view.
4. The method for displaying a card-style list based on iOS according to claim 3, characterized in that, The way to create a parent card is as follows: Create a parent card cell; Add a swipe gesture to the parent card cell to control the card to transform when the user swipes the card. When the user stops swiping and leaves the touch point, determine whether the transformation has reached the set size to decide whether to remove the card. Add a card removal animation to the parent class's card cell so that it plays when the card moves off-screen.
5. The method for displaying a card-style list based on iOS according to claim 4, characterized in that, Determine whether the transform deformation has reached the set size to decide whether to remove the card, including: Determine if the transform deformation reaches half the screen size; If the transform deformation reaches half the screen size, a card switching instruction is generated; If the transform does not reach half the screen size, restore the card.
6. The method for displaying a card-style list based on iOS according to claim 3, characterized in that, After deleting the target data from the data sequence, the method further includes: Detect the remaining quantity of data to be displayed in the data sequence; When the remaining number is less than z, new data to be displayed is retrieved and placed at the end of the data sequence to supplement the number of data to be displayed in the data sequence to y.
7. The method for displaying a card-style list based on iOS according to claim 6, characterized in that, x=4, y≤20, z∈(0,16].
8. A card-style list display device based on iOS, characterized in that, include: The card switching module is used to obtain a card switching instruction and remove the current card in the card display area based on the card switching instruction, and display the next card, wherein x cards are stacked in the card display area; The target data determination module is used to determine the target data that is currently ranked first from the pre-acquired data sequence, and to determine the data type of the target data, wherein the data sequence contains y data items to be displayed, and each data item to be displayed has a corresponding data type; The judgment module is used to determine whether the card type of the currently removed card corresponds to the data type of the target data; The target card unit determination module is used to determine the removed current card as a target card unit when the card type of the removed current card corresponds to the data type of the target data; and to place the removed current card into a cache pool for caching when the card type of the removed current card does not correspond to the data type of the target data, and to determine the target card unit whose card type corresponds to the data type of the target data from the cache pool, wherein the cache pool stores cards of multiple card types. The card to be displayed generation module is used to update the target data to the target card unit to obtain a card to be displayed, place the card to be displayed at the bottom layer of the card display area, and delete the target data from the data sequence.
9. A storage medium, characterized in that, The storage medium includes a stored program, wherein, when the program is running, it controls the device on which the storage medium is located to execute the iOS-based card list display method according to any one of claims 1 to 7.
10. An electronic device, characterized in that, The system includes a memory and a processor. The memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions. When the program instructions are loaded and executed by the processor, they implement the card-style list display method based on iOS as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method, equipment and system for reusing iOS (internet work operating system) end view resources, and storage medium
CN108334393A
Card type video interaction method, device and equipment and storage medium
CN114025218A
