Method and device for implementing a data-free placeholder view based on iOS sliding view
By adding extended attributes and methods to the iOS sliding view control, automatic detection and dynamic updating of data-free placeholder views are realized, which solves the problems of inflexible design and limited sliding operations in the existing technology, and improves the consistency and consistency of the user interface. Application stability.
Patent Information
- Application Number
- CN202311117747.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-31
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2043-08-31
AI Technical Summary
The design of the data-less placeholder view in existing iOS applications is inflexible, the sliding operation is limited, and there is a lack of automatic detection mechanism, resulting in high development complexity and poor user experience.
By adding extended properties and methods to the iOS sliding view control, you can create configurable data-free placeholder view properties, and use observers to monitor sliding displacements to achieve automatic detection and dynamic updates without affecting the pull-down refresh and up of the original list view. Sliding refresh function.
It improves the flexibility and user interface consistency of the data-free placeholder view, avoids errors caused by unclearing redundant data, and improves application stability and user experience.
Smart Images

Figure CN117149036B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of application development, and more particularly to a method and device for implementing a data-free placeholder view based on an iOS sliding view. Background Art
[0002] In actual iOS application development, list views are often used to display data and are equipped with sliding operations such as pull-down to refresh and swipe-up to refresh. However, when there is no data, a common practice is to display a placeholder view without data. The placeholder view may contain an image, prompt text, and an operation entry that the user can click to jump. The view may also support the function of sliding with user gestures.
[0003] The existing implementation methods of data-free placeholder views mainly have the following problems: First, inflexible view design: Different data-free placeholder views need to be specially designed and implemented for different scenarios or list types, which increases the workload and complexity of development. Second, limitations of sliding operations: Since data-free placeholder views are usually overlaid on existing pages, this will hinder the pull-down refresh and swipe-up refresh functions of the original list view. To implement these functions, additional coding and logic design are required. Third, lack of automatic detection mechanism: In existing technical solutions, data-free placeholder views usually need to be added manually by the caller. This may lead to redundancy or errors. For example, even if there is data on the page, the data-free placeholder view may still be displayed incorrectly. Summary of the invention
[0004] In view of this, an embodiment of the present application provides a method and device for implementing a data-free placeholder view based on an iOS sliding view to solve the problems of inflexible view design, large limitations on sliding operations, and lack of an automatic detection mechanism in the prior art.
[0005] In a first aspect of an embodiment of the present application, a method for implementing a data-free placeholder view based on an iOS sliding view is provided, comprising: creating an image enumeration and a configuration structure, wherein the image enumeration is used to represent different prompt images, and the configuration structure is used to store various layout configurations; adding extended attributes and extended methods to a sliding view control of the iOS system, and configuring an external interface function in the extended method; using the external interface function, creating a data-free placeholder view attribute in the sliding view control, the data-free placeholder view attribute being used to represent a data-free placeholder view displayed on the screen when there is no data; determining whether the current sliding view control contains list data, and when it is determined that there is no list data, initializing the data-free placeholder view attribute, and adding the initialized data-free placeholder view attribute to the current sliding view control; setting an observer to monitor the content displacement of the sliding view, and when the user performs a sliding operation, using the observer to obtain the latest sliding displacement, and updating the layout constraints of the data-free placeholder view according to the sliding displacement.
[0006] According to a second aspect of an embodiment of the present application, a data-free placeholder view implementation device based on an iOS sliding view is provided, comprising: a first creation module, configured to create an image enumeration and a configuration structure, wherein the image enumeration is used to represent different prompt images, and the configuration structure is used to store various layout configurations; an adding module, configured to add extended attributes and extended methods to the sliding view control of the iOS system, and configure an external interface function in the extended method; a second creation module, configured to use the external interface function to create a data-free placeholder view attribute in the sliding view control, wherein the data-free placeholder view attribute is used to represent the data-free placeholder view displayed on the screen when there is no data; a judgment module, configured to judge whether the current sliding view control contains list data, and when it is judged that there is no list data, the data-free placeholder view attribute is initialized, and the initialized data-free placeholder view attribute is added to the current sliding view control; an updating module, configured to set an observer to monitor the content displacement of the sliding view, and when the user performs a sliding operation, the observer is used to obtain the latest sliding displacement, and the layout constraints of the data-free placeholder view are updated according to the sliding displacement.
[0007] According to a third aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the above method are implemented when the processor executes the computer program.
[0008] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0009] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0010] By creating an image enumeration and a configuration structure, wherein the image enumeration is used to represent different prompt images, and the configuration structure is used to store various layout configurations; adding extended properties and extension methods to the sliding view control of the iOS system, and configuring the external interface function in the extension method; using the external interface function, creating a no-data placeholder view attribute in the sliding view control, the no-data placeholder view attribute is used to represent the no-data placeholder view displayed on the screen when there is no data; judging whether the current sliding view control contains list data, when it is judged that there is no list data, initializing the no-data placeholder view attribute, and adding the initialized no-data placeholder view attribute to the current sliding view control; setting an observer to monitor the content displacement of the sliding view, when the user performs a sliding operation, using the observer to obtain the latest sliding displacement, and updating the layout constraints of the no-data placeholder view according to the sliding displacement. The view type of this application is configurable and compatible with views of different layouts, realizing the pull-down refresh and swipe-up refresh functions without affecting the original list view, and can avoid the caller's mistake of not cleaning up redundant data. This makes the application highly adaptable, improves the consistency of the user interface and user experience, improves the stability and reliability of the application, and enhances the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0012] Figure 1 It is a flowchart of a method for implementing a data-free placeholder view based on an iOS sliding view provided in an embodiment of the present application;
[0013] Figure 2 It is a structural diagram of a device for implementing a data-free placeholder view based on an iOS sliding view provided in an embodiment of the present application;
[0014] Figure 3 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0015] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0016] As described in the background technology, in iOS application development, when a placeholder view without data needs to be displayed, the existing solution usually involves manually drawing a full-screen view to cover the entire page. This approach has multiple problems:
[0017] Lack of flexibility: Different scenarios or applications require specialized data-free placeholder views, which results in a large workload and reduces code reusability.
[0018] Operational restrictions: Because this placeholder view covers the entire page, the sliding operations of the original list view (such as UITableView or UICollectionView), including pull-down refresh and swipe-up refresh, will be blocked. To solve this problem, additional programming is required, which increases the difficulty of development.
[0019] Insufficient self-checking: This view needs to be added manually by the caller, and lacks a mechanism to automatically detect whether the data is actually empty. This may lead to unnecessary redundancy, such as displaying a placeholder view with no data when there is actually data to display.
[0020] In view of the deficiencies in the prior art, the present application proposes an improved implementation scheme for a data-free placeholder view. The present application establishes an extension on the base class of a slidable view (for example, UITableView or UICollectionView), and the scheme allows the view type to be configurable to adapt to different scenarios and layout requirements. The present application adds a data-free placeholder view to the background view of the slidable view instead of covering the entire page. This allows the sliding operations of the original list view (such as pull-to-refresh and swipe-to-refresh) to proceed normally. The technical solution of the present application has a self-checking function that can automatically determine whether the current view is actually missing data. When it is detected that there is still data on the page, the data-free placeholder view will not be displayed, or a corresponding prompt will be given, thereby avoiding unnecessary redundancy and misoperation.
[0021] The contents of the technical solution of the present application are described in detail below with reference to the accompanying drawings and specific embodiments.
[0022] Figure 1 It is a flow chart of a method for implementing a data-free placeholder view based on an iOS sliding view provided in an embodiment of the present application. Figure 1The method for implementing a data-free placeholder view based on an iOS sliding view can be executed by an application. Figure 1 As shown, the method for implementing the data-free placeholder view based on the iOS sliding view may specifically include:
[0023] S101, creating an image enumeration and a configuration structure, wherein the image enumeration is used to represent different prompt images, and the configuration structure is used to store various configurations of the layout;
[0024] S102, adding extended properties and extended methods to the sliding view control of the iOS system, and configuring external interface functions in the extended methods;
[0025] S103, using the external interface function, creating a no-data placeholder view attribute in the sliding view control, where the no-data placeholder view attribute is used to represent the no-data placeholder view displayed on the screen when there is no data;
[0026] S104, determining whether the current sliding view control contains list data, and when it is determined that there is no list data, initializing the no-data placeholder view attribute, and adding the initialized no-data placeholder view attribute to the current sliding view control;
[0027] S105, setting an observer to monitor the content displacement of the sliding view. When the user performs a sliding operation, the observer is used to obtain the latest sliding displacement, and the layout constraints of the data-free placeholder view are updated according to the sliding displacement.
[0028] First, some technical terms involved in the practical application scenarios of the embodiments of the present application are explained, which may specifically include the following:
[0029] UIScrollView: Slide View in iOS development Figure 1 Generally use UITableView, UICollectionView, and UIScrollView to do it. Among them, UITableView and UICollectionView are the base classes of UIScr ollView.
[0030] Extension: A feature provided by the iOS system that can add functionalities to existing classes (whether system-provided classes or custom classes).
[0031] Enumeration: A language feature of a programming language, consisting of different values. In the Swift language of the iOS system, enumeration is a type, and is known as one of the three major data types along with classes and structures.
[0032] Structure: A language feature of a programming language, similar to a class but without inheritance.
[0033] UIFont: Font class provided by the iOS system.
[0034] UIColor: Color class provided by the iOS system.
[0035] Boolean type: A language structure of a programming language that has only two values, true or false.
[0036] Observer: A function provided by the iOS system. An object A can observe a certain property of another object B. When the property changes, object A will receive a system callback. In the callback function, object A can implement any logic of its own.
[0037] In some embodiments, creating an image enumeration and configuration structure includes:
[0038] Create a picture enumeration data type. Each enumeration value in the picture enumeration corresponds to a prompt picture. Create a configuration structure for configuring the layout. The configuration structure contains multiple member variables. Each member variable is used to configure different properties of the dataless placeholder view.
[0039] Specifically, first create an image enumeration data type to store different types of prompt images. This image enumeration is called "PlaceholderImage", which includes multiple enumeration values, each of which corresponds to a specific prompt image. For example, one of the enumeration values is called "Car Image", which is used to represent an image about a car. Another enumeration value is called "Out of Stock Image", which is used to represent an image showing an out of stock status. This design allows users to easily select appropriate prompt images for different scenarios.
[0040] Furthermore, a configuration structure named "PlaceholderConfig" is created to configure multiple aspects of the dataless placeholder view in detail. The structure includes the following member variables:
[0041] A member variable of type UIFont used to set the prompt font, called messageFont.
[0042] A member variable of type UIColor called messageColor that is used to set the prompt color.
[0043] An array is used to set the background colors of multiple jump buttons. Each array element is an instance of the "UIColor" type, called "buttonBackgroundColors".
[0044] An array is used to set the border colors of multiple jump buttons. Each array element is an instance of the "UIColor" type, called "buttonBorderColors".
[0045] An array is used to set the border width of multiple jump buttons, each array element is a number, called "buttonBorderWidths".
[0046] An array is used to set the text fonts of multiple jump buttons. Each array element is an instance of the "UIFont" type, called "buttonTextFonts".
[0047] An array is used to set the text color of multiple jump buttons. Each array element is an instance of the "UIColor" type, called "buttonTextColors".
[0048] An array is used to set the spacing between the prompt and the button, and between the buttons. Each array element is a number called "spacings".
[0049] In one example, a user can fully customize their dataless placeholder view by creating an instance of "PlaceholderConfig" and setting the above member variables. For example, the user can set "messageFont" to the 16-point system font, set "messageColor" to gray, and add two elements of blue and green to the "buttonBackgroundColors" array, and so on.
[0050] In this way, by using the "PlaceholderImage" enumeration and the "PlaceholderConfig" structure, users can easily create a variety of dataless placeholder views for different applications or scenarios without having to do a lot of repetitive programming. This not only enhances the flexibility and configurability of the dataless placeholder view, but also greatly simplifies the development process.
[0051] In some embodiments, an extended attribute and an extended method are added to the sliding view control of the iOS system, and an external interface function is configured in the extended method, including:
[0052] Use the preset extension keywords to add extended properties and extension methods to the sliding view control, where the extended properties include configuration structure instances, no-data placeholder views, and observer properties, and the extended methods include external interface functions, which are used to configure and display no-data placeholder views.
[0053] Specifically, the embodiments of the present application specifically add a series of extended properties and extended methods for the sliding view control (or "UIScrollView") in the iOS system. These added functions are intended to provide a concise and flexible way to configure and display a placeholder view without data. The extended properties and extended methods are described in detail below in conjunction with specific embodiments, which may include the following:
[0054] 1. Extended attributes
[0055] 1)Configure the structure instance (PlaceholderConfig)
[0056] This is an open property. Developers or other external callers can use this member variable to fully configure the dataless placeholder view. Specifically, developers can first initialize and configure a configuration structure instance (the "PlaceholderConfig" described in the previous embodiment), and then assign the initialized instance to this member variable. In the subsequent drawing process, the extension will access the relevant properties of this configuration structure instance for drawing.
[0057] 2) No data placeholder view (PlaceholderView)
[0058] This is an internally used property that is used to add a no-data placeholder view to the background view of the sliding view (the property name is backgroundView). This no-data placeholder view is the actual layout that the user sees. The extension will save a reference to this view and release it when appropriate (such as after data is reloaded).
[0059] 3) Observer
[0060] This is also an internally used property. This observer is specifically used to monitor the contentOffset property of the sliding view. Simply put, contentOffset is a property that stores the displacement information of the sliding view in the X and Y directions. Through this observer, when the sliding view is slid (whether it is a user operation or a system-induced slide), the position of the no-data placeholder view will also be adjusted accordingly.
[0061] 2. Extension Methods
[0062] This extension also includes some external interface functions, which are mainly used to configure and display the placeholder view without data. Developers can call these interface functions to initialize, configure and display the placeholder view without data.
[0063] Furthermore, the implementation process of the data-free placeholder view includes the following steps:
[0064] First, configure the initialization and assignment of the structure instance. The developer first initializes a PlaceholderConfig instance and sets its member variables. Once the settings are completed, the instance can be assigned to the corresponding member variables of the extension.
[0065] Secondly, activation of the observer: In the external function described in the embodiment of the present application, an observer is created and assigned to the member variable "observer". Once assigned, the observer will continuously monitor the contentOffset property and update the position of the dataless placeholder view according to the change of this property.
[0066] Finally, display and update the no-data placeholder view. When the sliding view is empty or has no data, the extension will draw and display the no-data placeholder view according to the properties of the configuration structure instance. If the content or data of the sliding view changes, the extension will also update or remove the no-data placeholder view accordingly.
[0067] Through the extension method of the above embodiment, this extension not only greatly simplifies the configuration and management of the no-data placeholder view, but also provides a high degree of flexibility, allowing developers to easily create appropriate no-data placeholder views for different scenarios or requirements.
[0068] It should be noted that, since iOS itself does not support adding member variables in extensions, the embodiment of the present application provides the following method to replace the method of adding member variables in extensions, which may specifically include the following:
[0069] You can add computed variables (not storage properties) to the extension. For computed properties, iOS provides property wrappers, namely get and set.
[0070] Implemented in its set method: Call the function objc_setAssociatedObject() to bind an attribute and a class object together, and the binding key is a string.
[0071] Implemented in its get method: Call the function objc_getAssociatedObject() to return a property bound to the key value to the class object.
[0072] For example, in a specific example, the observer's implementation code is as follows:
[0073]
[0074]
[0075] The explanation of the above code is as follows: AssociatedKey.listOffsetObservationKey is a string; adding & in front means taking its address; OBJC_ASSOCIATION_RETAIN means that the binding method is retain, that is, the reference count +1 method; NSKeyValueObservation: is the observer system class provided by iOS.
[0076] In some embodiments, using an external interface function, creating a data-free placeholder view property in a sliding view control includes:
[0077] Create a no-data placeholder view property in the sliding view control. The no-data placeholder view property inherits the view control used to load other controls in iOS. Among them, the external interface function provides a display no-data placeholder view interface and a hide no-data placeholder view interface. The input parameters of the display no-data placeholder view interface include picture enumeration, prompt, button text and button callback function.
[0078] Specifically, the embodiment of the present application designs an extended function for the sliding view control (UIScrollView) of the iOS system, which is used to create and manage a special attribute: a placeholder view with no data. This placeholder view with no data inherits from the view control (UIView) used to load other controls in iOS. The content of the external interface function is described in detail below in conjunction with the specific embodiment, which may specifically include the following:
[0079] 1. Display the placeholder view with no data (ShowPlaceholderView). The external interface function is responsible for displaying the placeholder view with no data and provides the following input parameters:
[0080] 1) Image Enumeration (ImageEnum): used to specify what kind of image should be displayed currently. This enumeration value can be such as "car image", "out of stock image", etc.
[0081] 2) Prompt Text: Prompt text used for display, such as "No data" or "Loading failed".
[0082] 3) Button text (ButtonTextArray): Because there may be multiple buttons, this is an array of strings, each element representing the text that should be displayed on a button.
[0083] 4) Button callback function (ButtonCallbackArray): This is also an array, and each element of the array is a callback function. These callback functions correspond to each of the buttons mentioned above and are used to define the actions that should be performed after clicking these buttons.
[0084] 2. Hide the placeholder view with no data (HidePlaceholderView). The external interface function is also responsible for hiding the placeholder view with no data. When hiding the placeholder view with no data, the function has no input parameters and return values.
[0085] Since the solution to display the no-data placeholder view is to create an instance and add it to the background view of the sliding view, the hidden implementation is actually to remove the no-data placeholder view from the parent view: call the removeFromSuperview() method provided by the iOS system, and set the no-data placeholder view to empty (nil).
[0086] Furthermore, the working principle of the external interface function includes the following:
[0087] Data loading and refreshing: When the user pulls down to refresh or initializes the loading, the application will request list data from the server.
[0088] If the data request is successful and the number is greater than 0: the sliding view will display the list data normally. If the no-data placeholder view was displayed before, the view will be hidden by calling the "hide no-data placeholder view" interface function.
[0089] If the data request fails or the number is equal to 0: the sliding view will display the placeholder view with no data. At this time, the application will call the "display placeholder view with no data" interface function and pass appropriate parameters (such as image enumeration value, prompt, button text and button callback function) to correctly configure the placeholder view with no data.
[0090] Through the above embodiments, the application extension provides a very flexible and easy-to-use way to handle the state of no data in the sliding view. It allows developers to dynamically display or hide the no-data placeholder view through simple API calls, and also provides rich customization options, such as different types of prompt pictures, multiple operation buttons, etc. This not only enhances the user experience, but also facilitates developers to perform more refined control and management.
[0091] In some embodiments, determining whether the current sliding view control contains list data, and when determining that there is no list data, initializing the no-data placeholder view attribute, and adding the initialized no-data placeholder view attribute to the current sliding view control, includes:
[0092] Using the external interface function to call the operation of hiding the no-data placeholder view, so as to eliminate the no-data placeholder view existing on the current interface;
[0093] Determine whether there is list data in the current sliding view control. If there is no list data, obtain or create the background view of the current sliding view control.
[0094] Create the parent view, UIStackView instance, image view, text view, button view and observer of the data-free placeholder view in sequence;
[0095] Among them, the parent view of the data-free placeholder view contains all user-visible subviews, the UIStackView instance is used to organize and layout the subviews, the image view, text view and button view are added to the UIStackView instance, and the observer is used to monitor the scroll offset of the sliding view.
[0096] Specifically, the present application uses an external interface function to implement a process of displaying a placeholder view without data, which may include the following steps:
[0097] Step 1: Hide the current placeholder view with no data
[0098] The function first calls an operation called "hide no-data placeholder view" to eliminate the no-data placeholder view that may exist on the current interface.
[0099] Step 2: Determine whether there is list data in the current sliding view
[0100] The function then checks whether the sliding view contains any list data. If so, it does nothing, gives a prompt and returns. This step is to ensure that the sliding view is indeed empty and needs to display a no-data placeholder view.
[0101] Step 3: Get or create the background view of the sliding view
[0102] BackgroundView is a property of an iOS slide view (probably a UITableView or UICollectionView). If backgroundView is null, the code creates a new UIView instance and sets it as backgroundView.
[0103] Step 4: Create a placeholder parent view without data
[0104] This is a new UIView instance that contains all user-visible subviews (such as images, text, buttons, etc.). This view will be added to the backgroundView obtained or created in step 3.
[0105] Step 5: Create a UIStackView instance
[0106] Create a UIStackView instance to organize and lay out the subviews created in steps 6, 7, and 8.
[0107] Step 6: Create an image view
[0108] Create a UIImageView instance and set its image properties. This view will be added to the UIStackView created in step 5.
[0109] Step 7: Create a text view
[0110] Create a UILabel instance and set its text properties. This view will also be added to the UIStackView created in step 5.
[0111] Step 8. Create a button view
[0112] Create one or more UIButton instances based on the text array passed in, and set their titles and callback functions. These buttons will also be added to the UIStackView created in step 5.
[0113] Step 9. Create an observer
[0114] Finally, create an observer to listen to the contentOffset property of the scroll view. This allows the data-free placeholder view to dynamically adjust its position as the user scrolls.
[0115] In one example, for the data-free placeholder parent view created in step 4 above, all user-visible controls are laid out on it. After creating the data-free placeholder parent view, add the placeholder parent view to the background view of the sliding view (call the func addArrangedSubview(_view:UIView) function provided by the iOS system, and pass the placeholder parent view as a parameter), and set its layout, that is, the position and size, which is generally centered or upper-middle. Set the member variable "data-free placeholder view" as the placeholder parent view. For the sake of uniformity, this view can be called the data-free placeholder view.
[0116] Because the no-data placeholder view is added to the background view of the sliding view, and the background view is after the list, when there is no list, the background view, that is, the no-data placeholder view, will be displayed. Its existence will not affect other views and gestures of the sliding view, so the sliding view can be supported to pull down or slide up to refresh.
[0117] In another example, for the UIStackView instance created in step 5 above, after creating the UIStackView instance, add the UIStackView class instance to the placeholder parent view and set its layout, that is, position and size. Set the arrangement of the UIStackView class instance to vertical, the subview alignment to center alignment, and the spacing to the value of the property "interval" of the member variable "configuration structure instance".
[0118] In another example, for the image view created in step 6 above, the image view is an instance of the UIImageView class provided by the iOS system. Set its image attribute (the image attribute provided by the iOS system) to the value of the input parameter "image enumeration". After creating the image view, add the image view to the UIStackView class instance, for example, by calling the func addArrange dSubview(_view:UIView) function provided by the iOS system and passing the parameter to the image view.
[0119] In another example, for the text view created in step 7 above, the text view is an instance of the UILabel class provided by the iOS system. Its text attribute (text attribute provided by the iOS system) is set to the value of the input parameter "prompt". After creating the text view, the text view is added to the UI StackView class instance.
[0120] In another example, for the button view created in step 8 above, there may be multiple buttons, so create a loop to loop through the input parameter "button text array". In each loop body, write the following operations according to the current order index:
[0121] Create an instance of the UIButton class provided by the iOS system.
[0122] Set its text (func setTitle(_title:String!, for state:UIControl.State) function provided by the iOS system, the first parameter is the text, the second parameter is the state, just pass in the default state) to the value of the input parameter "button text" at the corresponding index.
[0123] Set its press callback function (func addTarget(_target:Any!,action:Selector,for controlEvents:UIControl.Event) function provided by the iOS system. The first parameter is the handler, just pass in self, the second parameter is the callback function, and the third parameter is the event type, just pass in the click event enumeration touchUpInside) as the value of the input parameter "button callback function" at the corresponding index.
[0124] After creation, add the button to the UIStackView class instance.
[0125] In another example, for the observer created in step 9 above, the embodiment of the present application creates an observer and assigns it to the member variable "observer". Since the embodiment of the present application is an extension of the sliding view, the self in the current program is the sliding view. Therefore, the observe method is called on self, and the first parameter passes in its member property contentOffset, and the second parameter passes in an array containing .new, which means that only the latest value is needed, and the third parameter passes in the callback function.
[0126] In the callback function, accept the latest value of the contentOffset property, access the y property of contentOffset, obtain its displacement in the y-axis direction, and reset the latest layout constraints of the dataless placeholder view according to business needs. And call the layoutIfNeeded() function or setNeed sLayout() function provided by the iOS system to update the constraints. This achieves the effect of the dataless placeholder view sliding along with the user's finger.
[0127] In some embodiments, determining whether list data exists in the current sliding view control includes:
[0128] Call the partition number query method of the current sliding view control to obtain the number of partitions; when the sliding view type is a table view, call the row number query method to accumulate the number of rows in each partition to obtain the total number of rows; when the sliding view type is a grid view, call the item number query method to accumulate the number of items in each partition to obtain the total number of items; determine whether the total number of rows or the total number of items is zero to determine whether there is list data in the current sliding view control.
[0129] Specifically, an embodiment of the present application provides a method for determining whether list data exists in the current sliding view (UIScrollView) control. The method determines whether a placeholder view with no data needs to be displayed. In practical applications, the method may include the following steps:
[0130] First, query the number of partitions
[0131] Call the numberOfSections() method of the sliding view to get the number of sections of the current sliding view.
[0132] Second, calculate the total number of lists
[0133] Table view (UITableView): If the sliding view is a table view, call the table view's numberOfRows(inSection:) method to calculate the number of rows in each section. Then, accumulate the number of rows in all sections to get the total number of rows.
[0134] UICollectionView: If the slide view is a collection view, call the collection view’s numberOfItems(inSection:) method to calculate the number of items in each section. Then, add up the number of items in all sections to get the total number of items.
[0135] Third, determine the total number
[0136] Compare the total number of rows or items obtained. If it is not 0, give a prompt and do nothing, and return directly.
[0137] Furthermore, in the actual development process, the above judgment method is widely used. For example, after successfully obtaining data from the server for the first time, the list data exists in the sliding view. However, when obtaining data from the server for the second time, the data acquisition may fail due to various reasons such as network problems and server errors. At this time, the program should display a placeholder view with no data.
[0138] However, before displaying the no-data placeholder view, the caller should first clear the invalid data in the sliding view, otherwise the data display may be chaotic. Therefore, the judgment method of the embodiment of the present application can be used as a prejudgment mechanism to ensure that the no-data placeholder view is displayed only when there is no valid data.
[0139] The advantage of doing so is that unnecessary interface flickering and user confusion can be avoided, while also reducing program logic complexity and error probability. In summary, the above embodiment provides a simple and efficient way for developers to determine whether there is valid list data in the sliding view.
[0140] In some embodiments, an observer is set to monitor the content displacement of the sliding view. When the user performs a sliding operation, the observer is used to obtain the latest sliding displacement, and the layout constraints of the data-free placeholder view are updated according to the sliding displacement, including:
[0141] Using the sliding view's own observation method, add an observer to monitor the content displacement property, and specify the latest value of the content displacement property to focus on; in the observer's callback function, obtain the latest value of the content displacement property in the vertical direction; according to the obtained vertical displacement value, reset the layout constraints of the data-free placeholder view, and call the layout update function provided by the system to update the position of the data-free placeholder view in real time.
[0142] Specifically, the embodiment of the present application will also add an observer to monitor the content displacement (contentOffset) of the sliding view (UIScrollView). When the user performs a sliding operation, the observer will obtain the latest sliding displacement and update the layout constraints of the data-free placeholder view according to this displacement value. The implementation of the observer includes the following steps:
[0143] 1. Add an observer: Use UIScrollView's observation method (such as addObserver(_:forKeyPath:options:context:)) to add an observer to monitor the contentOffset property. The observer pays attention to the latest value of contentOffset.
[0144] 2. Define the callback function: In the observer’s callback function (such as observeValue(forKeyPath:of:change:context:)), get the contentOffset property.
[0145] 3. Get the vertical displacement: In the callback function, get its y property from contentOffset, which is the latest displacement value in the vertical direction.
[0146] 4. Update layout constraints: Reset the layout constraints of the dataless placeholder view based on the obtained vertical displacement value. Specifically, you may need to update the constraint constants or use other layout techniques to reposition the dataless placeholder view.
[0147] 5. Trigger layout update: Call the layoutIfNeeded() function or setNeedsLayout() function provided by the iOS system to immediately update or mark the layout that needs to be updated.
[0148] It is very important to monitor the content displacement of the sliding view by setting an observer, especially when there are scenes like lists or scroll views in the application. For example, when there is no content (or very little content) in the sliding view, a no-data placeholder view is usually displayed. This no-data placeholder view may contain some prompt information, images, or action buttons. Through this observer mechanism, even when the user scrolls this almost empty sliding view, the no-data placeholder view will move appropriately, thus providing a better user experience.
[0149] The benefits of doing so include the following two aspects: First, it provides a dynamic way to update the user interface, making it more intuitive and user-friendly. Second, by programmatically controlling layout constraints, developers can more flexibly meet complex business needs and design requirements.
[0150] Therefore, by adding an observer to monitor the content displacement of the sliding view and updating the layout of the data-free placeholder view in the observer's callback function, the embodiment of the present application successfully implements a user-friendly and responsive UI design.
[0151] Based on the implementation process of the data-free placeholder view provided in the above embodiment, the following describes the use process of the data-free placeholder view in the actual scenario of the present application in combination with a specific embodiment, which may specifically include the following steps:
[0152] For example, suppose there is a news list app. The app uses a sliding view to display the news list. When the user pulls down to refresh, the app will get the latest news list from the server. If the list is empty, the app will display a data-free placeholder view, which may contain an image, prompt text, and a "Retry" button. The specific steps of the usage process are as follows:
[0153] 1. When the user pulls down to refresh for the first time, the app sends a request to the server to obtain the news list. After receiving the data, the app displays the news list normally in the sliding view. If a placeholder view with no data was displayed before, it will now be hidden.
[0154] 2. The user pulls down to refresh again, and the app sends a request to the server again. At this time, no data is obtained. The app clears the existing news list. Call the "Show No Data Placeholder View" interface of the sliding view, and the no data placeholder view will now be displayed on the interface.
[0155] 3. The user pulls down to refresh for the third time, and the app sends a request to the server again. This time, the data is successfully obtained. The app calls the "Hide No Data Placeholder View" interface of the sliding view. The No Data Placeholder View is hidden, and the new news list is displayed normally.
[0156] 4. The user swipes up to refresh and request the Nth page of data. The app sends a request to the server, trying to get the news list on page N. If the retrieval is successful, the new data will be added to the existing news list. If the retrieval fails, the app will check which page is currently on (via variable N). If N is equal to 1, it means it is the first page requested, and the app will clear all existing news lists and display a placeholder view with no data. If N is not equal to 1, it means it is not the first page, and the app will not do anything.
[0157] Through the above embodiments, this application not only shows how to use the no-data placeholder view in actual applications, but also demonstrates the complete process of interacting with the user (pull-down refresh and swipe-up refresh). This process includes how to correctly display and hide the no-data placeholder view, and how to update the list data in different situations.
[0158] According to the technical solution provided in the embodiment of the present application, the view type of the embodiment of the present application is configurable and compatible with views of different layouts. The embodiment of the present application supports different types of sliding views (such as table views, grid views, etc.), and can automatically identify their types and display or hide the placeholder view without data accordingly. This type flexibility makes the solution of the present application highly adaptable and can be seamlessly connected with application interfaces of different layouts and structures.
[0159] The present application adds an existing layout to the background view of the slidable view to implement the pull-down refresh and swipe-up refresh functions without affecting the original list view. The embodiment of the present application uses an extended feature to change the view hierarchy of the sliding view, rather than simply adding a new view on it. The advantage of doing so is that it can add a data-free placeholder view without interfering with the existing sliding view (such as the pull-down refresh and swipe-up refresh functions). This feature greatly improves the consistency of the user interface and the user experience.
[0160] This application has a self-checking function to avoid mistakes caused by redundant data not being cleaned up. This application solution also includes a self-checking mechanism that can detect whether there is list data in the sliding view. If it exists, the no-data placeholder view will not be displayed, or a corresponding prompt will be given. This self-checking function can reduce errors that may occur during implementation, such as the problem of redundant data not being cleaned up, thereby further improving the stability and reliability of the application.
[0161] Therefore, in summary, the embodiments of the present application solve multiple pain points in the prior art regarding view display, user interaction, and data management through a series of innovative designs and improvements. These technical effects not only improve the user experience, but also enhance the functionality and reliability of the application.
[0162] The following are device embodiments of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0163] Figure 2 Schematic diagram of the structure of the device for implementing the data-free placeholder view based on the iOS sliding view provided by the embodiment of the present application. Figure 2 As shown, the data-free placeholder view implementation device based on the iOS sliding view includes:
[0164] The first creation module 201 is configured to create an image enumeration and a configuration structure, wherein the image enumeration is used to represent different prompt images, and the configuration structure is used to store various configurations of the layout;
[0165] An adding module 202 is configured to add extended properties and extended methods to the sliding view control of the iOS system, and configure an external interface function in the extended method;
[0166] The second creation module 203 is configured to create a no-data placeholder view attribute in the sliding view control by using an external interface function, where the no-data placeholder view attribute is used to represent the no-data placeholder view displayed on the screen when there is no data;
[0167] The judging module 204 is configured to judge whether the current sliding view control contains list data. When it is judged that there is no list data, the no-data placeholder view attribute is initialized and the initialized no-data placeholder view attribute is added to the current sliding view control;
[0168] The updating module 205 is configured to set an observer to monitor the content displacement of the sliding view. When the user performs a sliding operation, the observer is used to obtain the latest sliding displacement, and the layout constraints of the data-free placeholder view are updated according to the sliding displacement.
[0169] In some embodiments, Figure 2 The first creation module 201 creates a data type of picture enumeration, each enumeration value in the picture enumeration corresponds to a prompt picture; creates a configuration structure for configuring the layout, the configuration structure includes multiple member variables, each member variable is used to configure different properties of the dataless placeholder view.
[0170] In some embodiments, Figure 2 The adding module 202 uses preset extension keywords to add extended properties and extended methods to the sliding view control, wherein the extended properties include configuration structure instances, no data placeholder views, and observer properties, and the extended methods include external interface functions, which are used to configure and display no data placeholder views.
[0171] In some embodiments, Figure 2 The second creation module 203 creates a no-data placeholder view attribute in the sliding view control. The no-data placeholder view attribute inherits the view control used to load other controls in iOS. Among them, the external interface function provides a display no-data placeholder view interface and a hide no-data placeholder view interface. The input parameters of the display no-data placeholder view interface include picture enumeration, prompt words, button text and button callback function.
[0172] In some embodiments, Figure 2 The judgment module 204 uses the external interface function to call the operation of hiding the no-data placeholder view to eliminate the no-data placeholder view existing on the current interface; judges whether there is list data in the current sliding view control, and when there is no list data, obtains or creates the background view of the current sliding view control; creates the parent view of the no-data placeholder view, the UIStackView instance, the picture view, the text view, the button view and the observer in sequence; wherein the parent view of the no-data placeholder view contains all the subviews visible to the user, the UIStackView instance is used to organize and layout the subviews, the picture view, the text view and the button view are added to the UIStackView instance, and the observer is used to monitor the scroll offset of the sliding view.
[0173] In some embodiments, Figure 2 The judgment module 204 calls the partition number query method of the current sliding view control to obtain the number of partitions; when the sliding view type is a table view, the row number query method is called to accumulate the number of rows in each partition to obtain the total number of rows; when the sliding view type is a grid view, the item number query method is called to accumulate the number of items in each partition to obtain the total number of items; and it is determined whether the total number of rows or the total number of items is zero to determine whether there is list data in the current sliding view control.
[0174] In some embodiments, Figure 2 The update module 205 uses the observation method of the sliding view itself to add an observer to monitor the content displacement attribute, and specifies the latest value of the content displacement attribute to be paid attention to; in the observer's callback function, the latest value of the content displacement attribute in the vertical direction is obtained; according to the obtained vertical displacement value, the layout constraints of the data-free placeholder view are reset, and the layout update function provided by the system is called to update the position of the data-free placeholder view in real time.
[0175] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0176] Figure 3 Schematic diagram of the structure of the electronic device 3 provided in the embodiment of the present application. Figure 3 As shown, the electronic device 3 of this embodiment includes: a processor 301, a memory 302, and a computer program 303 stored in the memory 302 and executable on the processor 301. When the processor 301 executes the computer program 303, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 301 executes the computer program 303, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0177] Exemplarily, the computer program 303 may be divided into one or more modules / units, which are stored in the memory 302 and executed by the processor 301 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 303 in the electronic device 3.
[0178] The electronic device 3 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 3 may include, but is not limited to, a processor 301 and a memory 302. Those skilled in the art will appreciate that Figure 3 It is only an example of the electronic device 3 and does not constitute a limitation of the electronic device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.
[0179] The processor 301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0180] The memory 302 may be an internal storage unit of the electronic device 3, for example, a hard disk or memory of the electronic device 3. The memory 302 may also be an external storage device of the electronic device 3, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 3. Further, the memory 302 may also include both an internal storage unit and an external storage device of the electronic device 3. The memory 302 is used to store computer programs and other programs and data required by the electronic device. The memory 302 may also be used to temporarily store data that has been output or is to be output.
[0181] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0182] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0183] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0184] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. Multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0185] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0186] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0187] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. Computer-readable media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0188] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for implementing a data-free placeholder view based on an iOS sliding view, wherein the sliding view includes a UITableView, a UICollectionView, and a UIScrollView, characterized in that: include: Create an image enumeration and a configuration structure, wherein the image enumeration is used to represent different prompt images, and the configuration structure is used to store various configurations of the layout; Add extended properties and extended methods to the sliding view control of the iOS system, and configure external interface functions in the extended methods; Using the external interface function, creating a no-data placeholder view attribute in the sliding view control, wherein the no-data placeholder view attribute is used to represent the no-data placeholder view displayed on the screen when there is no data; Determine whether the current sliding view control contains list data. When it is determined that there is no list data, obtain or create the background view of the current sliding view control, and create the parent view of the no-data placeholder view, the UIStackView instance, the picture view, the text view, the button view and the observer in sequence; wherein the parent view of the no-data placeholder view is added to the background view, the parent view of the no-data placeholder view contains all the subviews visible to the user, the UIStackView instance is used to organize and layout the subviews, and the picture view, the text view and the button view are added to the UIStackView instance; Set an observer to monitor the content displacement of the sliding view. When the user performs a sliding operation, use the observer to obtain the latest sliding displacement and update the layout constraints of the data-free placeholder view according to the sliding displacement. Also includes: When it is determined that the current sliding view control contains list data, the list data is displayed in the sliding view; When the user pulls down to refresh to obtain the latest list data, if the acquisition fails, first clear the invalid data in the current sliding view, and then use the external interface function to call the operation of displaying the placeholder view with no data to display the placeholder view with no data; if the acquisition is successful, first use the external interface function to call the operation of hiding the placeholder view with no data to eliminate the placeholder view with no data on the current interface, and then display the latest list data; When the user swipes up to refresh and requests the server to obtain the Nth page of data, if the acquisition is successful, the new data will be added to the existing news list; if the acquisition fails, when N is equal to 1, the list data in the current sliding view control is cleared, and the external interface function is used to call the operation of displaying the no-data placeholder view to display the no-data placeholder view.
2. The method according to claim 1, characterized in that The creation of picture enumeration and configuration structure includes: Create a data type of the picture enumeration, each enumeration value in the picture enumeration corresponds to a prompt picture; create a configuration structure for configuring the layout, the configuration structure includes multiple member variables, and each member variable is used to configure different properties of the dataless placeholder view.
3. The method according to claim 1, characterized in that The method of adding extended properties and extended methods to the sliding view control of the iOS system and configuring external interface functions in the extended methods includes: Use preset extension keywords to add extended properties and extended methods to the sliding view control, wherein the extended properties include a configuration structure instance, a data-free placeholder view, and an observer property, and the extended method includes an external interface function, which is used to configure and display a data-free placeholder view.
4. The method according to claim 1, characterized in that The step of using the external interface function to create a data-free placeholder view attribute in the sliding view control includes: The no-data placeholder view attribute is created in the sliding view control, and the no-data placeholder view attribute inherits the view control used to load other controls in iOS, wherein the external interface function provides a display no-data placeholder view interface and a hide no-data placeholder view interface, and the input parameters of the display no-data placeholder view interface include picture enumeration, prompt, button text and button callback function.
5. The method according to claim 1, characterized in that The determining whether list data exists in the current sliding view control includes: Call the partition number query method of the sliding view for the current sliding view control to obtain the number of partitions; when the sliding view type is a table view, call the row number query method to accumulate the number of rows in each partition to obtain the total number of rows; when the sliding view type is a grid view, call the item number query method to accumulate the number of items in each partition to obtain the total number of items; determine whether the total number of rows or the total number of items is zero to determine whether there is list data in the current sliding view control.
6. The method according to claim 1, characterized in that The setting of the observer to monitor the content displacement of the sliding view, when the user performs a sliding operation, using the observer to obtain the latest sliding displacement, and updating the layout constraints of the data-free placeholder view according to the sliding displacement, includes: Utilize the observation method of the sliding view itself, add an observer to monitor the content displacement attribute, and specify the latest value of the content displacement attribute to pay attention to; in the observer's callback function, obtain the latest value of the content displacement attribute in the vertical direction; according to the obtained vertical displacement value, reset the layout constraints of the dataless placeholder view, and call the layout update function provided by the system to update the position of the dataless placeholder view in real time.
7. A device for implementing a data-free placeholder view based on an iOS sliding view, characterized in that: include: A first creation module is configured to create an image enumeration and a configuration structure, wherein the image enumeration is used to represent different prompt images, and the configuration structure is used to store various configurations of the layout; An adding module is configured to add extended properties and extended methods to the sliding view control of the iOS system, and configure an external interface function in the extended method; A second creation module is configured to create a no-data placeholder view attribute in the sliding view control by using the external interface function, wherein the no-data placeholder view attribute is used to represent the no-data placeholder view displayed on the screen when there is no data; A judgment module is configured to judge whether the current sliding view control contains list data. When it is judged that there is no list data, the background view of the current sliding view control is obtained or created, and the parent view of the no-data placeholder view, the UIStackView instance, the picture view, the text view, the button view and the observer are sequentially created; wherein the parent view of the no-data placeholder view is added to the background view, the parent view of the no-data placeholder view contains all the subviews visible to the user, the UIStackView instance is used to organize and layout the subviews, and the picture view, the text view and the button view are added to the UIStackView instance; An update module is configured to set an observer to monitor the content displacement of the sliding view, and when the user performs a sliding operation, use the observer to obtain the latest sliding displacement, and update the layout constraints of the data-free placeholder view according to the sliding displacement; The device is also used for: When it is determined that the current sliding view control contains list data, the list data is displayed in the sliding view; When the user pulls down to refresh to obtain the latest list data, if the acquisition fails, first clear the invalid data in the current sliding view, and then use the external interface function to call the operation of displaying the placeholder view with no data to display the placeholder view with no data; if the acquisition is successful, first use the external interface function to call the operation of hiding the placeholder view with no data to eliminate the placeholder view with no data on the current interface, and then display the latest list data; When the user swipes up to refresh and requests the server to obtain the Nth page of data, if the acquisition is successful, the new data will be added to the existing news list; if the acquisition fails, when N is equal to 1, the list data in the current sliding view control is cleared, and the external interface function is used to call the operation of displaying the no-data placeholder view to display the no-data placeholder view.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
