View control method and device, electronic equipment and storage medium

By creating input views and placeholder views in iOS development and controlling the display status of placeholder views based on the input content, the problem of UITextView lacking placeholder information display function is solved, and the automatic management and accurate display of placeholder views are realized, which improves the stability and security of the system.

CN119718521APending Publication Date: 2025-03-28CHONGQING JINKANG NEW ENERGY VEHICLE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411893470.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In iOS development, UITextView system controls lack the function of natively supporting the display of placeholder information, which leads developers to implement placeholder views through inheritance and customization, which increases the risk of development complexity and instability.

Method used

By responding to the input box loading operation, create an input view and determine its layout properties, create a placeholder view based on the input view and layout properties, and control the display status of the placeholder view based on the input information in the input view.

Benefits of technology

It realizes automatic display or hiding of placeholder views, reduces development complexity, ensures accurate display of placeholder information, avoids relying on private APIs that are not open to iOS, and improves system stability and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718521A_ABST
    Figure CN119718521A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a view control method and device, electronic equipment and a storage medium. By responding to an input box loading operation, an input view corresponding to an input box is created, and layout attributes of the input view are determined; wherein the input view is used for a user to realize input operation; creating a placeholder view according to the input view and the layout attribute; wherein the layout attribute at least comprises size information and position information of the input view; therefore, the input information in the input view is determined, the display mode of the placeholder view is controlled according to the input information, automatic display or hiding of the placeholder view is realized on the premise of ensuring the accuracy of the display position of the placeholder view, the initial position of the placeholder view does not need to be calculated and stored in a large amount, the development complexity is reduced, and the development efficiency is improved. Accurate display of the placeholder information is guaranteed, an unopened private API depending on iOS is avoided, the stability is improved, and the security risk is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of application development, and in particular to a view control method and device, electronic equipment, and storage medium. Background Art

[0002] In iOS development, interface design often requires input boxes to have placeholder view functions. For example, when the user does not enter any content, the placeholder view is controlled to display placeholder text and other placeholder information to prompt the user what to enter.

[0003] However, the iOS related system control UITextView does not natively support the display of placeholder information; in related technologies, a common implementation method is that developers inherit UITextView and create a custom placeholder view to display placeholder information such as placeholder text.

[0004] However, related technical solutions usually need to calculate and store the initial position of the placeholder view and ensure that the placeholder text is consistent with the cursor position of the input content. The development complexity is high and inaccurate calculations may occur. This method may need to rely on private APIs that are not open to iOS, further increasing instability and security risks. Summary of the invention

[0005] In view of the above problems, a view control method and device, electronic device, and storage medium are proposed to overcome the above problems or at least partially solve the above problems, including:

[0006] A view control method, the method comprising:

[0007] In response to the input box loading operation, an input view corresponding to the input box is created, and a layout attribute of the input view is determined; wherein the input view is used for the user to implement the input operation;

[0008] Creating a placeholder view according to the input view and the layout attributes; wherein the layout attributes at least include size information and position information of the input view;

[0009] Determine the input information in the input view, and control the placeholder view to display according to the input information.

[0010] Optionally, controlling the placeholder view to be displayed according to the input information includes:

[0011] When the input information exists in the input view, controlling the placeholder view to be in a hidden state;

[0012] When the input information does not exist in the input view, the placeholder view is controlled to be in a display state.

[0013] Optionally, after creating the placeholder view according to the input view and the layout attribute, the method further includes:

[0014] The placeholder view is set to a non-editable and non-interactive state, and the background color of the placeholder view is adjusted to a transparent color.

[0015] Optionally, creating a placeholder view according to the input view and the layout attribute includes:

[0016] The placeholder view is created under the condition that the input view and the placeholder view have the same size information and position information.

[0017] Optionally, after creating the placeholder view according to the input view and the layout attribute, the method further includes:

[0018] A placeholder text member variable is added to the input view, and the placeholder text in the placeholder view is determined according to the placeholder text member variable.

[0019] Optionally, the method further includes:

[0020] A placeholder text color member variable is added to the input view, and the placeholder text color in the placeholder view is determined according to the placeholder text color member variable.

[0021] Optionally, the method further includes:

[0022] A font member variable and an alignment member variable are added to the input view, and the font and alignment in the input view and / or the placeholder view are determined according to the font member variable and the alignment member variable.

[0023] A view control device, comprising:

[0024] An input view determination module, used to create an input view corresponding to the input box in response to an input box loading operation, and determine the layout attributes of the input view; wherein the input view is used for the user to implement input operations;

[0025] A placeholder view creation module, used to create a placeholder view according to the input view and the layout attributes; wherein the layout attributes at least include size information and position information of the input view;

[0026] The placeholder view control module is used to determine the input information in the input view and control the placeholder view to display according to the input information.

[0027] An electronic device comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the view control method as described above when executed by the processor.

[0028] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the view control method described above is implemented.

[0029] The embodiments of the present invention have the following advantages:

[0030] In an embodiment of the present invention, a view control method is proposed, which creates an input view corresponding to an input box and determines the layout attributes of the input view in response to an input box loading operation; wherein the input view is used for users to implement input operations; then a placeholder view is created according to the input view and the layout attributes; wherein the layout attributes at least include size information and position information of the input view; thereby determining the input information in the input view and controlling the display of the placeholder view according to the input information, and realizing automatic display or hiding of the placeholder view while ensuring the accuracy of the display position of the placeholder view, without the need for a large amount of calculation and storage of the initial position of the placeholder view, reducing the complexity of development, ensuring the accurate display of the placeholder information, and avoiding dependence on private APIs not open to iOS, thereby improving stability and reducing security risks. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0032] Figure 1 is a flowchart of a view control method provided by some embodiments of the present invention;

[0033] Figure 2 is a flowchart of another view control method provided by some embodiments of the present invention;

[0034] Figure 3 It is a structural schematic diagram of a view control device provided by some embodiments of the present invention. DETAILED DESCRIPTION

[0035] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0036] In iOS development, interface design often requires input boxes to have placeholder view functions. For example, when the user does not enter any content, the placeholder view is controlled to display placeholder text and other placeholder information to prompt the user what to enter.

[0037] However, the iOS related system control UITextView does not natively support the display of placeholder information; in related technologies, a common implementation method is that developers inherit UITextView and create a custom placeholder view to display placeholder information such as placeholder text.

[0038] However, related technical solutions usually need to calculate and store the initial position of the placeholder view and ensure that the placeholder text is consistent with the cursor position of the input content. The development complexity is high and inaccurate calculations may occur. This method may need to rely on private APIs that are not open to iOS, further increasing instability and security risks.

[0039] In the embodiment of the present invention, based on the core technical concept of creating an input view and a placeholder view with the same layout attributes, the view control method in the related art is improved. The present invention will be described in detail below with reference to the accompanying drawings:

[0040] Reference Figure 1 , shows a flowchart of a view control method provided by some embodiments of the present invention, which may specifically include the following steps:

[0041] Step 101, in response to an input box loading operation, creating an input view corresponding to the input box, and determining a layout attribute of the input view; wherein the input view is used for a user to implement an input operation;

[0042] In a specific implementation, an input view corresponding to an input box can be created in response to an input box loading operation, for example, in response to an input box loading operation on a web page or application for users to implement input operations; for example, in IOS, an input view can be customized by inheriting from UITextView for users to implement input operations, and the layout properties of the created input view, such as size information and position information, can be further determined for use in the subsequent input view creation process.

[0043] Step 102: creating a placeholder view according to the input view and the layout attributes; wherein the layout attributes at least include size information and position information of the input view;

[0044] In a specific implementation, the input view created in the above steps can be used as a parent view, and a placeholder view can be created according to the input view and the layout attributes of the input view. For example, the placeholder view can be created under the condition that the input view and the placeholder view have the same size information and position information to ensure the consistency between the two.

[0045] Specifically, you can add a member variable under the parent input view: placeholder view; type: UITextView; and you can create an instance of the UITextView in the property initialization method, and its system property settings can be as follows:

[0046] Background color: transparent;

[0047] Whether to allow user interaction: No;

[0048] Whether to allow editing by users: No;

[0049] Furthermore, you can write the following steps in the initialization method of the parent input view:

[0050] (1) Listen to the parent input view's own system notifications:

[0051] UITextView.textDidChangeNotification is a notification sent by the system when the user is about to enter or delete text in the parent input view, and a notification callback function can be further written.

[0052] (2) Add the placeholder view to the parent input view and make it a child view of the parent input view

[0053] (3) Set the layout properties of the placeholder view: You can keep the layout of the placeholder view consistent with that of the parent input view. That is, the size information such as length and width of the placeholder view and the position information such as x and y are consistent with the parent input view. Figure 1 It can be understood that the placeholder view covers the parent input view.

[0054] On this basis, in order to control the display of the placeholder view in real time, you can write the following steps in the notification callback function of the parent input view:

[0055] Determine whether the parent input view currently has text:

[0056] If the parent input view currently has text, you can set the member property of the placeholder view: hidden; to true, that is, the placeholder view is not displayed on the interface at this time, and the user actually sees the parent input view.

[0057] If the parent input view currently has no text, you can set the member property of the placeholder view: hidden; to false, that is, the placeholder view is displayed on the interface at this time. What the user actually sees is the placeholder view.

[0058] In some embodiments of the present invention, after creating the placeholder view according to the input view and the layout attribute, the method further includes:

[0059] The placeholder view is set to a non-editable and non-interactive state, and the background color of the placeholder view is adjusted to a transparent color.

[0060] In actual applications, as mentioned above, you can add a member variable under the parent input view: placeholder view; type: UITextView; and you can create an instance of the UITextView in the property initialization method, and its system property settings can be as follows:

[0061] Background color: transparent;

[0062] Whether to allow user interaction: No;

[0063] Whether to allow editing by users: No;

[0064] Through the above settings, it can be ensured that the placeholder view is used exclusively to display the placeholder information, is not editable and cannot be interacted with, and is only used as a carrier view for the placeholder information; the possibility of interactive conflicts between the placeholder view and the input view is avoided, and the user input experience is improved. In addition, the transparent setting of the background ensures that the placeholder view and the input view can be seamlessly switched visually, making the appearance of the placeholder information more natural and intuitive for users.

[0065] In some embodiments of the present invention, creating a placeholder view according to the input view and the layout attribute includes:

[0066] The placeholder view is created under the condition that the input view and the placeholder view have the same size information and position information.

[0067] In practical applications, as mentioned above, the placeholder view can be created under the condition that the input view and the placeholder view have the same size information and position information to ensure the consistency between the two.

[0068] Specifically, you can add a member variable under the parent input view: placeholder view; type: UITextView; and you can create an instance of the UITextView in the property initialization method, and its system property settings can be as follows:

[0069] Background color: transparent;

[0070] Whether to allow user interaction: No;

[0071] Whether to allow editing by users: No;

[0072] Furthermore, you can write the following steps in the initialization method of the parent input view:

[0073] (1) Listen to the parent input view's own system notifications:

[0074] UITextView.textDidChangeNotification is a notification sent by the system when the user is about to enter or delete text in the parent input view, and a notification callback function can be further written.

[0075] (2) Add the placeholder view to the parent input view and make it a child view of the parent input view

[0076] (3) Set the layout properties of the placeholder view: You can keep the layout of the placeholder view consistent with that of the parent input view. That is, the size information such as length and width of the placeholder view and the position information such as x and y are consistent with the parent input view. Figure 1 It can be understood that the placeholder view covers the parent input view.

[0077] The above settings ensure that the placeholder view and the input view have the same size and position, and the placeholder text is precisely aligned with the input content, avoiding visual deviation caused by position calculation errors. The position of the placeholder text in the input box is consistent with the actual input content, without the need for additional calculations and adjustments, which improves development efficiency.

[0078] In some embodiments of the present invention, after creating the placeholder view according to the input view and the layout attribute, the method further includes:

[0079] A placeholder text member variable is added to the input view, and the placeholder text in the placeholder view is determined according to the placeholder text member variable.

[0080] In the specific implementation, because the placeholder view needs to maintain consistent display properties with the parent input view (to avoid a discordant visual experience for users), the placeholder view should also be synchronized with other visible settings of the parent input view.

[0081] On this basis, you can add a member variable under the parent input view: placeholder text; the type can be: String; used to store the content of the placeholder text. And you can write in the didSet function of this property: set the member property text of the placeholder view to the placeholder text; so that through the didSet observer, when the placeholder text changes, it can be automatically synchronized to the text property of the placeholder view. In this way, the placeholder text content in the placeholder view can be directly updated by dynamically assigning values ​​to the parent input view member variable.

[0082] In some embodiments of the present invention, the method further comprises:

[0083] A placeholder text color member variable is added to the input view, and the placeholder text color in the placeholder view is determined according to the placeholder text color member variable.

[0084] In actual applications, you can add a member variable under the parent input view: the color of the placeholder text; its type can be: UIColor; used to define the color of the placeholder text; you can write in the didSet function of this property: set the member property textColor of the placeholder view to the color of the placeholder text; so that through the didSet observer, when the placeholder text color changes, it can be automatically synchronized to the textColor property of the placeholder view. This can ensure that the text color in the parent input view is consistent with the placeholder text color displayed by the placeholder view or can be set as required, which can avoid visual conflicts or inconsistencies; and simplify the management logic of the placeholder text color, and dynamic synchronization of color changes does not require additional code processing, reducing development and maintenance costs.

[0085] In some embodiments of the present invention, the method further comprises:

[0086] A font member variable and an alignment member variable are added to the input view, and the font and alignment in the input view and / or the placeholder view are determined according to the font member variable and the alignment member variable.

[0087] In actual applications, you can add a member variable under the parent input view: font; its type can be: UIFont; used to define the font style of the input view and the placeholder text; and in the set function of the property, you can write: set the member attribute font of the placeholder view to the new value of the attribute "font", and set the font of the super to the new value, that is, in the set method, update the font attribute of the placeholder view and the parent input view itself (that is, the font attribute of the super) at the same time; you can also write in the get function of the property: return the member attribute font of the super, that is, in the get method, directly return the font style of the parent class (super) to avoid repeated storage of font information. Among them, super is the parent class of the parent input view. Through the above settings, not only can the font of the parent input view be set, but also the font of the placeholder view; and the specific value of "font" is also handed over to the parent class super for storage; it can ensure the consistency of the font style between the placeholder text and the text actually entered by the user, and manage the font attributes through the parent class (super), which can reduce unnecessary redundant storage.

[0088] Furthermore, you can add a member variable under the parent input view: alignment; the type can be: NSTextAlignment; used to define the alignment of the text; and in the set function of the attribute, you can write: set the member attribute textAlignment of the placeholder view to the new value of the attribute "alignment", and set the textAlignment of the super to the new value, so that in the set method, the textAlignment attribute of the placeholder view and the parent input view itself (that is, the textAlignment attribute of the super) are updated at the same time. You can also write in the get function of the attribute: return the member attribute textAlignment of the super, so that in the get method, the alignment of the parent class (super) is directly returned to avoid repeated storage of alignment information, and can ensure the consistency of the alignment of the placeholder text and the text actually entered by the user without additional calculation or adjustment. The alignment attributes can also be managed through the parent class (super) to reduce unnecessary redundant storage.

[0089] Step 103: determine the input information in the input view, and control the placeholder view to display according to the input information.

[0090] In a specific implementation, it is possible to determine whether there is input information in the input view, such as input text, so that the placeholder view can be controlled to be hidden when there is input information in the input view; or the placeholder view can be controlled to be displayed when there is no input information in the input view;

[0091] Specifically, as mentioned above, you can write the steps in the notification callback function of the parent input view:

[0092] Determine whether the parent input view currently has text:

[0093] If the parent input view currently has text, you can set the member property of the placeholder view: hidden; to true, that is, the placeholder view is not displayed on the interface at this time, and the user actually sees the parent input view.

[0094] If the parent input view currently has no text, you can set the member property of the placeholder view: hidden; to false, that is, the placeholder view is displayed on the interface at this time. What the user actually sees is the placeholder view.

[0095] Through the above settings, the display status of the placeholder view can be dynamically controlled to hide the placeholder view when there is input information in the input view, and display the placeholder view when there is no input information, ensuring that the placeholder view is displayed only when needed, thereby improving the intuitiveness of user interaction and enhancing the real-time responsiveness of the system.

[0096] In some embodiments of the present invention, controlling the placeholder view to be displayed according to the input information includes:

[0097] When the input information exists in the input view, controlling the placeholder view to be in a hidden state;

[0098] When the input information does not exist in the input view, the placeholder view is controlled to be in a display state.

[0099] In actual application, as mentioned above, you can write the steps in the notification callback function of the parent input view:

[0100] Determine whether the parent input view currently has text:

[0101] If the parent input view currently has text, you can set the member property of the placeholder view: hidden; to true, that is, the placeholder view is not displayed on the interface at this time, and the user actually sees the parent input view.

[0102] If the parent input view currently has no text, you can set the member property of the placeholder view: hidden; to false, that is, the placeholder view is displayed on the interface at this time. What the user actually sees is the placeholder view.

[0103] Through the above settings, the display status of the placeholder view can be dynamically controlled to hide the placeholder view when there is input information in the input view, and display the placeholder view when there is no input information, ensuring that the placeholder view is displayed only when needed, thereby improving the intuitiveness of user interaction and enhancing the real-time responsiveness of the system.

[0104] Reference Figure 2 , shows a flowchart of another view control method provided by some embodiments of the present invention, which may specifically include the following steps:

[0105] Step 201, in response to an input box loading operation, creating an input view corresponding to the input box, and determining a layout attribute of the input view; wherein the input view is used for a user to implement an input operation;

[0106] In a specific implementation, an input view corresponding to an input box can be created in response to an input box loading operation, for example, in response to an input box loading operation on a web page or application for users to implement input operations; for example, in IOS, an input view can be customized by inheriting from UITextView for users to implement input operations, and the layout properties of the created input view, such as size information and position information, can be further determined for use in the subsequent input view creation process.

[0107] Step 202: creating a placeholder view according to the input view and the layout attributes; wherein the layout attributes at least include size information and position information of the input view;

[0108] In a specific implementation, the input view created in the above steps can be used as a parent view, and a placeholder view can be created according to the input view and the layout attributes of the input view. For example, the placeholder view can be created under the condition that the input view and the placeholder view have the same size information and position information to ensure the consistency between the two.

[0109] Specifically, you can add a member variable under the parent input view: placeholder view; type: UITextView; and you can create an instance of the UITextView in the property initialization method, and its system property settings can be as follows:

[0110] Background color: transparent;

[0111] Whether to allow user interaction: No;

[0112] Whether to allow editing by users: No;

[0113] Furthermore, you can write the following steps in the initialization method of the parent input view:

[0114] (1) Listen to the parent input view's own system notifications:

[0115] UITextView.textDidChangeNotification is a notification sent by the system when the user is about to enter or delete text in the parent input view, and a notification callback function can be further written.

[0116] (2) Add the placeholder view to the parent input view and make it a child view of the parent input view

[0117] (3) Set the layout properties of the placeholder view: You can keep the layout of the placeholder view consistent with that of the parent input view. That is, the size information such as length and width of the placeholder view and the position information such as x and y are consistent with the parent input view. Figure 1 It can be understood that the placeholder view covers the parent input view.

[0118] On this basis, in order to control the display of the placeholder view in real time, you can write the following steps in the notification callback function of the parent input view:

[0119] Determine whether the parent input view currently has text:

[0120] If the parent input view currently has text, you can set the member property of the placeholder view: hidden; to true, that is, the placeholder view is not displayed on the interface at this time, and the user actually sees the parent input view.

[0121] If the parent input view currently has no text, you can set the member property of the placeholder view: hidden; to false, that is, the placeholder view is displayed on the interface at this time. What the user actually sees is the placeholder view.

[0122] Step 203, setting the placeholder view to a non-editable and non-interactive state, and adjusting the background color of the placeholder view to a transparent color;

[0123] In actual applications, as mentioned above, you can add a member variable under the parent input view: placeholder view; type: UITextView; and you can create an instance of the UITextView in the property initialization method, and its system property settings can be as follows:

[0124] Background color: transparent;

[0125] Whether to allow user interaction: No;

[0126] Whether to allow editing by users: No;

[0127] Through the above settings, it can be ensured that the placeholder view is used exclusively to display the placeholder information, is not editable and cannot be interacted with, and is only used as a carrier view for the placeholder information; the possibility of interactive conflicts between the placeholder view and the input view is avoided, and the user input experience is improved. In addition, the transparent setting of the background ensures that the placeholder view and the input view can be seamlessly switched visually, making the appearance of the placeholder information more natural and intuitive for users.

[0128] Step 204, when the input information exists in the input view, controlling the placeholder view to be in a hidden state;

[0129] In actual applications, you can write the steps in the notification callback function of the parent input view:

[0130] Determine whether the parent input view currently has text:

[0131] If the parent input view currently has text, you can set the member property of the placeholder view: hidden; to true, that is, the placeholder view is not displayed on the interface at this time, and the user actually sees the parent input view.

[0132] If the parent input view currently has no text, you can set the member property of the placeholder view: hidden; to false, that is, the placeholder view is displayed on the interface at this time. What the user actually sees is the placeholder view.

[0133] Through the above settings, the display status of the placeholder view can be dynamically controlled to hide the placeholder view when there is input information in the input view, and display the placeholder view when there is no input information, ensuring that the placeholder view is displayed only when needed, thereby improving the intuitiveness of user interaction and enhancing the real-time responsiveness of the system.

[0134] Step 205: When the input information does not exist in the input view, control the placeholder view to be in a display state.

[0135] In actual applications, you can write the steps in the notification callback function of the parent input view:

[0136] Determine whether the parent input view currently has text:

[0137] If the parent input view currently has text, you can set the member property of the placeholder view: hidden; to true, that is, the placeholder view is not displayed on the interface at this time, and the user actually sees the parent input view.

[0138] If the parent input view currently has no text, you can set the member property of the placeholder view: hidden; to false, that is, the placeholder view is displayed on the interface at this time. What the user actually sees is the placeholder view.

[0139] Through the above settings, the display status of the placeholder view can be dynamically controlled to hide the placeholder view when there is input information in the input view, and display the placeholder view when there is no input information, ensuring that the placeholder view is displayed only when needed, thereby improving the intuitiveness of user interaction and enhancing the real-time responsiveness of the system.

[0140] In an embodiment of the present invention, in response to an input box loading operation, an input view corresponding to the input box is created and the layout attributes of the input view are determined; wherein the input view is used for users to implement input operations; then a placeholder view is created according to the input view and the layout attributes; wherein the layout attributes include at least size information and position information of the input view; thereby determining the input information in the input view and controlling the display of the placeholder view according to the input information, thereby realizing automatic display or hiding of the placeholder view while ensuring the accuracy of the display position of the placeholder view, without the need for a large amount of calculation and storage of the initial position of the placeholder view, reducing the complexity of development, ensuring the accurate display of the placeholder information, and avoiding dependence on private APIs that are not open to iOS, thereby improving stability and reducing security risks.

[0141] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0142] Reference Figure 3 , shows a schematic diagram of the structure of a view control device provided by some embodiments of the present invention, which may specifically include the following modules:

[0143] An input view determination module 301 is used to create an input view corresponding to the input box in response to an input box loading operation, and determine a layout attribute of the input view; wherein the input view is used for a user to implement an input operation;

[0144] A placeholder view creation module 302, configured to create a placeholder view according to the input view and the layout attributes; wherein the layout attributes at least include size information and position information of the input view;

[0145] The placeholder view control module 303 is used to determine the input information in the input view, and control the placeholder view to display according to the input information.

[0146] In some embodiments of the present invention, the placeholder view control module 303 includes:

[0147] A hidden state control submodule, used for controlling the placeholder view to be in a hidden state when the input information exists in the input view;

[0148] The display state control submodule is used to control the placeholder view to be in a display state when the input information does not exist in the input view.

[0149] In some embodiments of the present invention, the device further comprises:

[0150] The placeholder view setting module is used to set the placeholder view to a non-editable and non-interactive state, and adjust the background color of the placeholder view to a transparent color.

[0151] In some embodiments of the present invention, the placeholder view creation module 302 includes:

[0152] The placeholder view creation submodule is used to create the placeholder view under the condition that the input view and the placeholder view have the same size information and position information.

[0153] In some embodiments of the present invention, the device further comprises:

[0154] The placeholder text member variable adding module is used to add a placeholder text member variable in the input view, and determine the placeholder text in the placeholder view according to the placeholder text member variable.

[0155] In some embodiments of the present invention, the device further comprises:

[0156] The placeholder text color member variable adding module is used to add a placeholder text color member variable in the input view, and determine the placeholder text color in the placeholder view according to the placeholder text color member variable.

[0157] In some embodiments of the present invention, the device further comprises:

[0158] The font and alignment member variable adding module is used to add font member variables and alignment member variables in the input view, and determine the font and alignment in the input view and / or the placeholder view according to the font member variables and alignment member variables.

[0159] Some embodiments of the present invention further provide an electronic device, which may include a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and the computer program implements the above view control method when executed by the processor.

[0160] Some embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above view control method is implemented.

[0161] Some embodiments of the present invention further provide a computer program product, including a computer program, which implements the above view control method when executed by a processor.

[0162] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0163] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0164] Those skilled in the art will appreciate that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0165] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0166] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0167] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0168] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0169] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the above elements.

[0170] The view control method and device, electronic device, and storage medium provided above are introduced in detail. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A view control method, characterized in that: The method comprises: In response to the input box loading operation, an input view corresponding to the input box is created, and a layout attribute of the input view is determined; wherein the input view is used for the user to implement the input operation; Creating a placeholder view according to the input view and the layout attributes; wherein the layout attributes at least include size information and position information of the input view; Determine the input information in the input view, and control the placeholder view to display according to the input information.

2. The method according to claim 1, characterized in that The controlling the placeholder view to display according to the input information includes: When the input information exists in the input view, controlling the placeholder view to be in a hidden state; When the input information does not exist in the input view, the placeholder view is controlled to be in a display state.

3. The method according to claim 1, characterized in that After creating the placeholder view according to the input view and the layout attribute, the method further includes: The placeholder view is set to a non-editable and non-interactive state, and the background color of the placeholder view is adjusted to a transparent color.

4. The method according to claim 1, characterized in that: The creating a placeholder view according to the input view and the layout attribute includes: The placeholder view is created under the condition that the input view and the placeholder view have the same size information and position information.

5. The method according to claim 1, characterized in that After creating the placeholder view according to the input view and the layout attribute, the method further includes: A placeholder text member variable is added to the input view, and the placeholder text in the placeholder view is determined according to the placeholder text member variable.

6. The method according to claim 5, characterized in that The method further comprises: A placeholder text color member variable is added to the input view, and the placeholder text color in the placeholder view is determined according to the placeholder text color member variable.

7. The method according to claim 5, characterized in that The method further comprises: A font member variable and an alignment member variable are added to the input view, and the font and alignment in the input view and / or the placeholder view are determined according to the font member variable and the alignment member variable.

8. A view control device, characterized in that: The device comprises: An input view determination module, used to create an input view corresponding to the input box in response to an input box loading operation, and determine the layout attributes of the input view; wherein the input view is used for the user to implement input operations; A placeholder view creation module, used to create a placeholder view according to the input view and the layout attributes; wherein the layout attributes at least include size information and position information of the input view; The placeholder view control module is used to determine the input information in the input view and control the placeholder view to display according to the input information.

9. An electronic device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the view control method according to any one of claims 1 to 7 when executed by the processor.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the view control method according to any one of claims 1 to 7 is implemented.