Status bar display control method and device, computer device, and storage medium

By obtaining the view identifier and parameters to determine the view operation type, and calling the status bar modification function to adjust the status bar, the problem of incorrect status bar display in traditional technology is solved, and the correct display of the page status bar is achieved.

CN122363564APending Publication Date: 2026-07-10TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2021-08-25
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

In traditional techniques, when adding or switching pages using the addSubview method, the view controller cannot distinguish between adding a normal view and switching pages, causing the system's status bar setting method to fail and the page's status bar to not display correctly.

Method used

By responding to view switching operations, the system obtains the view identifier and parameters, determines whether the view parameters meet the page size requirements, detects the call to the transition animation interface, determines the view operation type, and calls the status bar modification function to perform custom settings and adjust the status bar.

Benefits of technology

Accurately identifying view operation types ensures the status bar is displayed correctly when a page is added or switched, resolving the issue of view controllers failing to detect page state changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122363564A_ABST
    Figure CN122363564A_ABST
Patent Text Reader

Abstract

This application relates to a status bar display control method, apparatus, computer device, and storage medium. The method includes: responding to a view switching operation and obtaining a view identifier corresponding to the view switching operation; when the view switching operation is determined to be an add subview operation, obtaining view parameters corresponding to the view switching operation; when the view parameters meet preset page size requirements and a call to a transition animation interface is detected, determining that the add subview operation is an add page operation, and obtaining the corresponding status bar modification function based on the view identifier; adjusting the status bar by calling a preset custom status bar setting method through the status bar modification function, and displaying the page with the adjusted status bar. This method can correctly display the page's status bar.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application filed with the Chinese Patent Office on August 25, 2021, with application number 202110983098.7, entitled "Status Bar Display Control Method, Apparatus, Computer Equipment and Storage Medium", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of computer technology, and in particular to a status bar display control method, apparatus, computer device, and storage medium. Background Technology

[0003] With the development of computer technology, status bar display control technology has emerged. The status bar refers to the bar at the top of a mobile terminal that displays information such as operator, network, time, and battery level.

[0004] In traditional technology, each page on a mobile terminal has a corresponding view controller to manage the display of the page view. When a page jump or return is detected, the corresponding view controller will detect and intercept the page jump through methods such as viewWillAppear and viewDisApear, thereby setting the page's status bar.

[0005] However, if pages are added or switched using the addSubview method, since this method is equivalent to adding the view directly to the existing page, the view controller cannot distinguish between a normal view addition and a page jump, and will not detect the page state change. This causes the system's status bar setting method to fail, thus preventing the page's status bar from being set and displayed correctly. Summary of the Invention

[0006] Therefore, it is necessary to provide a status bar display control method, device, computer equipment, and storage medium that can correctly display the page status bar in order to address the above-mentioned technical problems.

[0007] A method for controlling status bar display, the method comprising:

[0008] Respond to view switching operations and obtain the view identifier corresponding to the view switching operation;

[0009] When it is determined that the view switching operation is an add subview operation, obtain the view parameters corresponding to the view switching operation;

[0010] When the view parameters meet the preset page size requirements and a call to the transition animation interface is detected, the operation of adding a subview is determined to be an operation of adding a page, and the corresponding status bar modification function is obtained according to the view identifier;

[0011] The status bar is adjusted by calling a preset custom status bar setting method through the status bar modification function, and the page with the adjusted status bar is displayed.

[0012] A status bar display control device, the device comprising:

[0013] The response module is used to respond to view switching operations and obtain the view identifier corresponding to the view switching operation.

[0014] The acquisition module is used to acquire the view parameters corresponding to the view switching operation when it is determined that the view switching operation is an add subview operation;

[0015] The judgment module is used to determine that adding a subview operation is an adding page operation when the view parameters meet the preset page size requirements and a call to the transition animation interface is detected, and to obtain the corresponding status bar modification function based on the view identifier.

[0016] The adjustment module is used to adjust the status bar by calling a preset custom status bar setting method through the status bar modification function, and then displaying the page after the status bar adjustment.

[0017] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program performing the following steps:

[0018] Respond to view switching operations and obtain the view identifier corresponding to the view switching operation;

[0019] When it is determined that the view switching operation is an add subview operation, obtain the view parameters corresponding to the view switching operation;

[0020] When the view parameters meet the preset page size requirements and a call to the transition animation interface is detected, the operation of adding a subview is determined to be an operation of adding a page, and the corresponding status bar modification function is obtained according to the view identifier;

[0021] The status bar is adjusted by calling a preset custom status bar setting method through the status bar modification function, and the page with the adjusted status bar is displayed.

[0022] A computer-readable storage medium having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0023] Respond to view switching operations and obtain the view identifier corresponding to the view switching operation;

[0024] When it is determined that the view switching operation is an add subview operation, obtain the view parameters corresponding to the view switching operation;

[0025] When the view parameters meet the preset page size requirements and a call to the transition animation interface is detected, the operation of adding a subview is determined to be an operation of adding a page, and the corresponding status bar modification function is obtained according to the view identifier;

[0026] The status bar is adjusted by calling a preset custom status bar setting method through the status bar modification function, and the page with the adjusted status bar is displayed.

[0027] The aforementioned status bar display control method, device, computer equipment, and storage medium, by responding to view switching operations, obtains the view identifier corresponding to the view switching operation. When it is determined that the view switching operation is an add subview operation, it obtains the view parameters corresponding to the view switching operation. By using whether the view parameters meet the preset page size requirements and whether a call to the transition animation interface is detected, it determines whether the add subview operation is an add page operation. This can accurately determine the add page operation. Therefore, when it is determined that the add subview operation is an add page operation, the corresponding status bar modification function can be obtained based on the view identifier. The status bar modification function calls the preset custom setting status bar method to adjust the status bar. This solves the problem that when adding or switching pages by adding subviews, the view controller cannot detect the page change status, and the system setting status bar method will fail, thus correctly displaying the page status bar. Attached Figure Description

[0028] Figure 1 This is a flowchart illustrating a status bar display control method in one embodiment;

[0029] Figure 2 This is a flowchart illustrating the initialization management process in one embodiment;

[0030] Figure 3 This is a flowchart illustrating the status bar display control method in another embodiment;

[0031] Figure 4 This is a structural block diagram of a status bar display control device in one embodiment;

[0032] Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0033] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0034] In one embodiment, such as Figure 1As shown, a status bar display control method is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, or to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. It can also be a node in a blockchain. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein. In this embodiment, the method includes the following steps:

[0035] Step 102: Respond to the view switching operation and obtain the view identifier corresponding to the view switching operation.

[0036] View switching operations refer to switching the currently displayed view to a new view. For example, a view switching operation could specifically refer to a page switching operation, i.e., switching to a new page. Another example is adding a subview, in which case it's necessary to further determine whether the added subview is a page view or a non-page view. The view identifier corresponds to the new view to which the user is about to switch and is a unique identifier for the new view. For example, the view identifier could specifically refer to the new view's configuration ID (Identity document).

[0037] Specifically, when a user wants to switch views, they will interact with the terminal to perform the view switching operation. The terminal will respond to the view switching operation and obtain the view identifier corresponding to the operation. For example, when a user wants to navigate to a new page, they can interact with the control on the terminal corresponding to the new page to perform the view switching operation.

[0038] Step 104: When it is determined that the view switching operation is an operation to add a subview, obtain the view parameters corresponding to the view switching operation.

[0039] The "add subview" operation refers to adding or switching views using the `addSubview` method. Since this method essentially adds the view directly to the existing page, the view controller cannot distinguish whether it's a page transition. Therefore, it's necessary to obtain the view parameters corresponding to the view switching operation to determine whether adding a subview is a page addition operation. View parameters refer to the size of the view to be added. For example, view parameters could specifically refer to the coordinates and width / height of the view to be added. For instance, view parameters can be obtained by retrieving `view.fram`.

[0040] Specifically, the user has pre-rewritten the `add subview` method. This rewritten method can detect subview addition operations. When the terminal responds to a view switching operation, this rewritten method detects the subview addition operation to determine if the view switching operation is indeed a subview addition operation. If it is determined that the view switching operation is a subview addition operation, the terminal obtains the view parameters corresponding to the view switching operation to determine whether the subview addition operation is a page addition operation.

[0041] Step 106: When the view parameters meet the preset page size requirements and a call to the transition animation interface is detected, determine that the operation of adding a subview is an operation of adding a page, and obtain the corresponding status bar modification function according to the view identifier.

[0042] The preset page size requirement refers to the pre-set size requirements for the page view, which can be set as needed. For example, the page size requirement can be consistent with the width and height of the display screen. Transition animation refers to the gradual entry of the landing page from right to left or from bottom to top when navigating between pages. The status bar refers to the bar at the top of the mobile terminal that displays information such as carrier, network, time, and battery level. The status bar modification function is a function that modifies the status bar corresponding to the page view to be displayed. This includes setting parameters such as status bar style, hiding / showing the status bar, and setting status bar color, as well as calling status bar setting methods. The status bar modification function corresponds to the page view to be displayed and can be pre-set and deployed based on the page view. For example, when a user navigates to different pages within the application, the status bar will display differently depending on the page. For instance, when the main color of page A is white, the status bar may need to be displayed as white; however, when navigating from page A to page B, where the main color of page B is red, the status bar will need to be displayed as red.

[0043] Specifically, the terminal compares the view parameters with the preset page size requirements. When the view parameters meet the preset page size requirements and a call to the transition animation interface is detected, the "add subview" operation is determined to be a "add page" operation. The terminal then further retrieves the corresponding status bar modification function based on the view identifier to adjust the status bar. Within the application project, there is a unified entry function for calling the transition animation interface. As long as the view identifier can be captured in the entry function, it can be confirmed that a call to the transition animation interface has been detected.

[0044] Step 108: Adjust the status bar by calling the preset custom status bar setting method through the status bar modification function, and display the page after the status bar adjustment.

[0045] The preset custom status bar settings methods refer to pre-defined methods for configuring the status bar, including setting the status bar style, hiding / showing the status bar, and setting the status bar color. It's important to note that these custom status bar settings methods do not affect the normal execution of the system status bar settings methods in the view controller. The terminal will create a new UIApplication category, ControlStatusBar, and add methods for setting the status bar style, hiding / showing the status bar, and setting the status bar color within this control status bar. Hook operations are executed through this control status bar to access the system status bar settings methods. When a system status bar settings method is captured, the custom status bar settings methods added to the control status bar are invoked. Here, "category" refers to a development technique that allows adding methods to system classes.

[0046] Specifically, after obtaining the status bar modification function, the terminal will call the preset custom status bar setting method through the status bar modification function, adjust the status bar according to the setting parameters in the status bar modification function such as setting status bar style, hiding / showing status bar, and setting status bar color, and display the page with the adjusted status bar.

[0047] The status bar modification function corresponds to the page view to be displayed. The status bar display mode corresponding to the page view is pre-set in the status bar modification function. When adjusting the status bar, it first determines whether the status bar needs to be displayed. If the status bar needs to be hidden, it will be hidden directly when the status bar is adjusted. When the page with the status bar adjusted is displayed, there will be no status bar at the top of the page. If the status bar does not need to be hidden, the terminal will further adjust the status bar according to the setting parameters such as the status bar style and status bar color in the status bar modification function to display the page with the status bar adjusted.

[0048] Furthermore, setting the status bar color is to ensure that the status bar color matches the color of the page view to be displayed. For example, adjusting the status bar color can be done as follows: the terminal obtains the first color category information of the title bar of the page view to be displayed; based on the first color category information, it determines the color adaptation information for the status bar; and based on the color adaptation information, it configures the status bar color to match the color of the title bar of the page view to be displayed. Another example is that the terminal obtains the first color category information of the title bar and the second color category information of the status bar of the page view to be displayed; based on the first and second color category information, it determines whether the title bar color matches the status bar color; if the title bar color does not match the status bar color, it performs an operation to adjust the status bar color according to the first color category information. Yet another example is that color adjustment information is pre-stored in the status bar color setting parameters, and the terminal directly adjusts the status bar color based on this information. The first color category information, the second color category information, and the color adjustment information can specifically refer to the category of a color, such as red, blue, or yellow, or to the RGB (red / green / blue) values ​​of the color. This embodiment does not impose any specific limitations here. The above-described status bar display control method, by responding to view switching operations, obtains the view identifier corresponding to the view switching operation. When it is determined that the view switching operation is an add subview operation, it obtains the view parameters corresponding to the view switching operation. It uses whether the view parameters meet the preset page size requirements and whether a call to the transition animation interface is detected to determine whether the add subview operation is an add page operation. This accurately determines the add page operation, and when it is determined that the add subview operation is an add page operation, it obtains the corresponding status bar modification function based on the view identifier. The status bar modification function calls a preset custom status bar setting method to adjust the status bar, solving the problem that when adding or switching pages via add subviews, the view controller cannot detect the page change state, and the system's status bar setting method fails to function, thus correctly displaying the page's status bar.

[0049] In one embodiment, when the view switching operation is determined to be an add subview operation, before obtaining the view parameters corresponding to the view switching operation, the method further includes:

[0050] Respond to the overridden operation of the add subview method, and detect the add subview operation through the overridden add subview method.

[0051] Specifically, the user will override the "Add Subview" method under `keyWindow`, and the terminal will respond to the overridden operation of the "Add Subview" method. This allows the addition of a subview to be detected through the overridden method. For example, the overriding method could be: a custom `TXWindow` class inherits from the `UIWindow` class, and the `addSubview` method (adding a subview) is overridden in the `.m` file of the `TXWindow` class.

[0052] In this embodiment, by responding to the overriding operation of the add subview method, the add subview operation can be detected through the overridden add subview method.

[0053] In one embodiment, the status bar display control method further includes:

[0054] Query whether a corresponding view controller exists based on the view identifier;

[0055] When a view controller corresponding to a view identifier exists, the view switching operation is determined to be a page switching operation;

[0056] Call the system settings status bar method in the corresponding view controller;

[0057] The system executes a hook operation on the status bar settings method, calls the preset custom status bar settings method to adjust the status bar, and displays the page after the status bar adjustment.

[0058] The view controller manages the display of the page view. When the page navigates or returns, the view controller detects and intercepts the page navigation using methods such as `viewWillAppear` and `viewDisApear`, thereby setting the page's status bar. Hook operations are used to capture the system's status bar setting method, gaining control over it and allowing for processing or modification. In this embodiment, the specific modification method involves calling a preset custom status bar setting method to adjust the status bar.

[0059] Specifically, if a view switching operation is a page switching operation, a view controller corresponding to the view identifier must exist. However, for adding a subview operation, there is no view controller corresponding to its view identifier. Therefore, the terminal only needs to query whether a corresponding view controller exists based on the view identifier to determine whether the view switching operation is a page switching operation. When a view controller corresponding to the view identifier exists, the view switching operation can be determined to be a page switching operation. Furthermore, the terminal has a pre-set heap space that stores the view identifier and the address of the corresponding view controller. When the address of the corresponding view controller is found in the heap space based on the view identifier, it can be determined that a view controller corresponding to the view identifier exists. In addition, the terminal also has a pre-set variable array that stores the status bar modification records corresponding to the executed page switching. The form of the status bar modification record is view identifier - address of view controller / view identifier - address of status bar modification function. Because the heap space stores too much data, when retrieving the status bar modification function or querying and retrieving the view controller, the terminal will first query the variable array. If the corresponding data is not found in the variable array, it will then query the heap space to improve the retrieval / query efficiency.

[0060] Specifically, when a view controller corresponding to the view identifier exists, the terminal will call the system settings status bar method in the corresponding view controller to adjust the status bar. At this time, since a control status bar category for hooking the system settings status bar method has been created in advance, the terminal will perform a hook operation on the system settings status bar method to call the preset custom settings status bar method to adjust the status bar and display the page after the status bar is adjusted.

[0061] For example, a user might override the `load` method in the status bar control category. Within the `load` method, they could hook the system status bar settings method. This would involve the following steps: 1. Obtain the system status bar settings method and the custom status bar settings method using `class_getInstanceMethod` (the method to get an instance of the class); 2. Swap the system status bar settings method using the `method_exchangeImplemtation` method (the implementation of the swapped method); 3. Inside the custom status bar settings method, call both `self` (the custom status bar settings method) and the system status bar settings method to ensure the system status bar settings method executes correctly. This allows the system status bar settings method to be hooked back to the custom status bar settings method added to the status bar control category when it is captured.

[0062] In this embodiment, by querying whether a corresponding view controller exists based on the view identifier, the page switching operation can be determined. Then, by calling the system setting status bar method in the corresponding view controller, a hook operation is performed on the system setting status bar method, and a preset custom setting status bar method is called to adjust the status bar and display the page after the status bar is adjusted, thus realizing the adjustment of the status bar.

[0063] In one embodiment, the status bar display control method further includes:

[0064] When the view switching operation is executed for the first time, a status bar modification record is generated based on the view identifier and the status bar adjustment method corresponding to the view switching operation, and the status bar modification record is stored in a preset variable array.

[0065] The pre-defined variable array is used to store modification records for the status bar's display / hide and status bar style (including status bar pattern and color). The variable array acts as an index; the modification record specifically refers to the address of the status bar adjustment method. The status bar adjustment method corresponds to the view switching operation, and different view switching operations use different status bar adjustment methods. For example, for a page switching operation, the corresponding status bar adjustment method is using a view controller, so the corresponding status bar modification record is the address of the view controller. Similarly, for an operation to add a subview, the corresponding status bar adjustment method is using a status bar modification function, so the corresponding status bar modification record is the address of the status bar modification function. Specifically, there can be two pre-defined variable arrays, one for storing the status bar display / hide modification record and the other for storing the status bar style modification record.

[0066] Specifically, the terminal adds a variable array to the status bar category to store changes to the status bar's display / hide settings and style, using the variable array for stack management. When a view switching operation is executed for the first time, the terminal generates a status bar modification record based on the view identifier and the corresponding status bar adjustment method, storing this record in the pre-defined variable array. It's important to note that attributes cannot be directly added to a category. If a variable array needs to be used as a category attribute, it can be saved using the `objc_setAssociatedObject` function (establishing associated attributes) in MethodSwizzling technology. When storing status bar modification records in the pre-defined variable array, a setter method selector is used to assign values ​​to the array. MethodSwizzling is a syntax feature used in iOS development, allowing iOS programs to perform hooks during runtime.

[0067] In this embodiment, a status bar modification record is generated based on the view identifier and the status bar adjustment method corresponding to the view switching operation. The status bar modification record is stored in a preset variable array, which enables the storage of status bar modification records so that when switching to the same page again, the corresponding status bar modification record can be quickly retrieved from the variable array to adjust the status bar.

[0068] In one embodiment, after storing the status bar modification records into a preset variable array, the method further includes:

[0069] Respond to the page return operation and obtain the return page identifier corresponding to the page return operation;

[0070] Retrieve the corresponding status bar modification record from the variable array based on the returned page identifier;

[0071] Adjust the status bar based on the status bar modification record corresponding to the returned page identifier, and display the page with the adjusted status bar.

[0072] Specifically, when a user performs a page back operation, the terminal responds by obtaining the return page identifier corresponding to the page back operation. Based on this identifier, it retrieves the corresponding status bar modification record from a variable array. Then, based on the status bar modification record corresponding to the return page identifier, it obtains the address of the view controller / status bar modification function corresponding to the page to be displayed. Using this address, it retrieves the view controller / status bar modification function and adjusts the status bar of the page to be displayed, thus displaying the page with the adjusted status bar. When retrieving the corresponding status bar modification record from the variable array, the terminal calls the `objc_getAssociatedObjec` method (to retrieve associated attributes), passing in a getter method selector, and retrieves the corresponding status bar modification record from the variable array using the getter method selector.

[0073] In this embodiment, by responding to the page return operation and obtaining the return page identifier corresponding to the page return operation, the corresponding status bar modification record can be quickly obtained from the variable array based on the return page identifier. This allows for the adjustment of the status bar using the status bar modification record corresponding to the return page identifier, thereby improving adjustment efficiency.

[0074] In one embodiment, the status bar display control method further includes:

[0075] Get the first address of the main thread object and the second address of the currently calling thread, which is the thread that performs the adjustment of the status bar;

[0076] When the first address and the second address are different, the status bar will be adjusted and executed in the main thread.

[0077] The main thread object refers to the object that executes in the main thread. The currently calling thread is the thread that performs the adjustments to the status bar.

[0078] Specifically, during development, UI (User Interface) modifications and event execution must be performed on the main thread; otherwise, program crashes and other errors will occur. Therefore, when adjusting the status bar, it's necessary to determine if the adjustment is being performed on the main thread. The terminal obtains the first address of the main thread object and the second address of the currently calling thread, comparing the first and second addresses. If the first and second addresses are different, it indicates that the currently calling thread is not the main thread, and the status bar adjustment needs to be performed on the main thread. If the first and second addresses are the same, it indicates that the currently calling thread is the main thread, and no adjustment is needed.

[0079] For example, the terminal can obtain the first address of the main thread object through `NSThread.mainThread`, and then obtain the second address of the currently calling thread through `NSThread.currentThread`. If the addresses of the two threads are the same, the currently calling thread is the main thread; if the addresses of the two threads are different, it is not the main thread. In this case, the terminal will issue a warning to the corresponding page and call the GCD (Grand Central Dispatch) function to place the status bar adjustment into the main thread for execution. Specifically, the placement method is as follows: obtain the main queue through `dispatch_get_main_queue`, then call the `dispatch_async` function of the GCD function to start an asynchronous task, and place the call to adjust the status bar in the main thread for execution.

[0080] In this embodiment, by obtaining the first address of the main thread object and the second address of the currently calling thread, which is the thread that performs the adjustment of the status bar, when the first address and the second address are different, the adjustment of the status bar is placed in the main thread for execution. This ensures that the adjustment of the status bar is performed in the main thread, avoiding errors such as program crashes.

[0081] In one embodiment, the status bar display control method further includes:

[0082] Receive page view adjustment parameters, which include page identifier, switching method, and status bar modification data;

[0083] When the switching method is to add a view switch, store the page identifier and the status bar modification data;

[0084] When the switching method is page switching, modify the data settings in the status bar to match the view controller corresponding to the page switching, and store the page identifier and the view controller corresponding to the page switching.

[0085] In this context, "status bar modification data" refers to the specific data used to modify the status bar of the page view. Different switching methods correspond to different status bar modification data. For example, when the switching method is "add view switch," the corresponding status bar modification data is the status bar modification function. Or, when the switching method is "page switch," the corresponding status bar modification data is the parameters used to change the status bar in the view controller.

[0086] Specifically, when a new page is added online, the server sends page view adjustment parameters to the terminal. Upon receiving these parameters, the terminal determines the corresponding switching method. When the switching method is "add view switch," it stores the status bar modification data and directly stores the page identifier and the entry point for retrieving the status bar modification data into a pre-defined heap space. When the switching method is "page switch," the terminal needs to obtain the view controller template, set it according to the status bar modification data, obtain the view controller corresponding to the page switch, and store this view controller, storing the page identifier and the entry point for retrieving the view controller into the pre-defined heap space. Specifically, setting the view controller template according to the status bar modification data can be achieved by extracting the base class of the view controller template and modifying the status bar in the `viewWillAppear` method of the base class based on the status bar modification data.

[0087] In this embodiment, after receiving page view adjustment parameters, the system can store the added view switch, page switch, and corresponding status bar modification data according to different switching methods.

[0088] This application also provides an application scenario in which the above-described status bar display control method is applied. Specifically, the status bar display control method is applied in this scenario as follows:

[0089] Before responding to view switching operations, the terminal needs to be initialized and managed. An example process is as follows: Figure 2 As shown.

[0090] The terminal will create a new category called `ControlStatusBar` within `UIApplication`, and add methods to this control status bar, such as setting the status bar style, hiding / showing the status bar, and setting the status bar color. The system status bar settings method will be hooked through this control status bar. Specifically, the hooking methods can be: 1. Obtaining the system status bar settings method and the custom status bar settings method using `class_getInstanceMethod`; 2. Swapping the system status bar settings method using `method_exchangeImplemtation`; 3. Calling `self` (the custom status bar settings method) and the system status bar settings method within the custom status bar settings method to ensure the system status bar settings method executes correctly. Therefore, when the system status bar settings method is captured, the call will be replaced with the custom status bar settings method we added in the control status bar category.

[0091] Simultaneously, the terminal will respond to the operation of adding a variable array in the control status bar category to store the modification history of status bar display / hide and status bar style, using the variable array to implement stack management. Specifically, there can be two variable arrays: `statusBarIsVisible` to store the status bar display / hide modification history and `statusBarStyleChangeHistory` to store the status bar style modification history. Furthermore, the terminal will also respond to the overridden operation of the add subview method, allowing the addition of a subview to be detected through the overridden method and intercepted.

[0092] like Figure 3 As shown, after initialization, the program in the terminal will start. When the program starts, the status bar is black and not hidden by default. At this time, the server will issue the new online page, specifically the page view adjustment parameters. After receiving the page view adjustment parameters, the terminal will perform corresponding settings and data storage according to different switching methods. When the switching method is adding a view, the terminal will store the status bar modification data, directly storing the page identifier and the entry point for obtaining the status bar modification data into the preset heap space. When the switching method is page switching, the terminal needs to obtain the view controller template, set the view controller template according to the status bar modification data, obtain the view controller corresponding to the page switching, store the view controller corresponding to the page switching, and store the page identifier and the entry point for obtaining the view controller corresponding to the page switching into the preset heap space (i.e., the viewController to be modified in the status bar).

[0093] When a user performs a view switching operation (i.e., the page starts loading / jumps / goes back), the terminal will respond to the view switching operation by detecting the addition of a subview through the rewritten add subview method and querying whether the corresponding view controller exists based on the view identifier.

[0094] When the view switching operation is determined to be an add subview operation, the terminal obtains the view parameters corresponding to the view switching operation (i.e., detects the width and height of the view). When the view parameters meet the preset page size requirements and a call to the transition animation interface is detected, the add subview operation is determined to be an add page operation. Based on the view identifier, the corresponding status bar modification function is obtained (i.e., the current page status bar modification data is obtained). The status bar is adjusted by calling the preset custom status bar setting method through the status bar modification function, and the page with the adjusted status bar is displayed (here corresponding to...). Figure 3 (The branch in the current page whose status bar needs to be changed). When the status bar modification function does not call the preset custom status bar setting method, it means that the current page status bar does not need to be changed. In this case, the default setting will be used, which is the pre-set default status bar style.

[0095] When a view controller corresponding to a view identifier exists, the terminal determines that the view switching operation is a page switching operation. It then calls the system status bar setting method in the corresponding view controller. The terminal executes a hook operation on this method, calling a preset custom status bar setting method to adjust the status bar and display the page with the adjusted status bar. (That is, it detects the `viewWillAppear` / `viewDisAppear` methods to obtain the current page's status bar modification data and adjusts it when the current page's status bar needs to be changed.) It should be noted that if the current page's status bar does not need to be changed, the system status bar setting method in the corresponding view controller will not be called.

[0096] When adjusting the status bar, the terminal needs to determine whether the current calling thread that is adjusting the status bar is the main thread. If the current calling thread is not the main thread, a warning will be issued to the corresponding page, and the adjustment of the status bar will be executed in the main thread.

[0097] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.

[0098] In one embodiment, such as Figure 4 As shown, a status bar display control device is provided. This device can be a software module, a hardware module, or a combination of both, integrated into a computer device. Specifically, the device includes: a response module 402, an acquisition module 404, a judgment module 406, and an adjustment module 408, wherein:

[0099] Response module 402 is used to respond to view switching operations and obtain the view identifier corresponding to the view switching operation;

[0100] The acquisition module 404 is used to acquire the view parameters corresponding to the view switching operation when it is determined that the view switching operation is an add subview operation;

[0101] The judgment module 406 is used to determine that the operation of adding a subview is an operation of adding a page when the view parameters meet the preset page size requirements and a call to the transition animation interface is detected, and to obtain the corresponding status bar modification function according to the view identifier.

[0102] The adjustment module 408 is used to adjust the status bar by calling a preset custom status bar setting method through the status bar modification function, and display the page after the status bar adjustment.

[0103] The aforementioned status bar display control device, by responding to view switching operations, obtains the view identifier corresponding to the view switching operation. When it is determined that the view switching operation is an add subview operation, it obtains the view parameters corresponding to the view switching operation. By using whether the view parameters meet the preset page size requirements and whether a call to the transition animation interface is detected, it determines whether the add subview operation is an add page operation. This accurately determines the add page operation, and when it is determined that the add subview operation is an add page operation, it obtains the corresponding status bar modification function based on the view identifier. The status bar modification function calls the preset custom status bar setting method to adjust the status bar, thus solving the problem that when adding or switching pages by adding subviews, the view controller cannot detect the page change status, and the system status bar setting method will fail, thus correctly displaying the page status bar.

[0104] In one embodiment, the status bar display control device further includes a detection module, which is used to respond to the rewrite operation of the add subview method and detect the add subview operation through the rewritten add subview method.

[0105] In one embodiment, the status bar display control device further includes a processing module. The processing module is used to query whether a corresponding view controller exists based on the view identifier. When a view controller corresponding to the view identifier exists, the view switching operation is determined to be a page switching operation. The system setting status bar method in the corresponding view controller is called, a hook operation is performed on the system setting status bar method, and a preset custom setting status bar method is called to adjust the status bar and display the page after the status bar is adjusted.

[0106] In one embodiment, the status bar display control device further includes a storage module, which is used to generate a status bar modification record based on the view identifier and the status bar adjustment method corresponding to the view switching operation when the view switching operation is executed for the first time, and store the status bar modification record in a preset variable array.

[0107] In one embodiment, the adjustment module is further configured to respond to a page return operation, obtain a return page identifier corresponding to the page return operation, obtain the corresponding status bar modification record from a variable array based on the return page identifier, adjust the status bar based on the status bar modification record corresponding to the return page identifier, and display the page with the adjusted status bar.

[0108] In one embodiment, the adjustment module is further used to obtain the first address of the main thread object and the second address of the currently calling thread, where the currently calling thread is the thread that performs the adjustment of the status bar. When the first address and the second address are different, the adjustment of the status bar will be performed in the main thread.

[0109] In one embodiment, the storage module is further configured to receive page view adjustment parameters, which include page identifier, switching method, and status bar modification data. When the switching method is to add view switching, the page identifier and status bar modification data are stored. When the switching method is to switch pages, the view controller corresponding to the page switching is set according to the status bar modification data, and the page identifier and the view controller corresponding to the page switching are stored.

[0110] Specific limitations regarding the status bar display control device can be found in the limitations of the status bar display control method described above, and will not be repeated here. Each module in the aforementioned status bar display control device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0111] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a status bar display control method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device casing, or an external keyboard, touchpad, or mouse.

[0112] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0113] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0114] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0115] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.

[0116] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0117] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0118] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A status bar display control method, characterized in that, The method includes: In response to a view switching operation, obtain the view identifier corresponding to the view switching operation; When it is determined that the view switching operation is an add subview operation, the view parameters corresponding to the view switching operation are obtained; the view parameters include the size of the view to be added, which are used to determine whether the add subview operation is an add page operation; If the operation of adding a subview is determined to be an operation of adding a page based on the view parameters, the corresponding status bar modification function is obtained based on the view identifier; the status bar modification function is a function that modifies the status bar corresponding to the page view to be displayed. The status bar modification function calls a preset custom status bar setting method, and adjusts the status bar according to the status bar color setting parameters in the status bar modification function so that the status bar color matches the color of the page view to be displayed, and displays the page with the adjusted status bar.

2. The method according to claim 1, characterized in that, The step of adjusting the status bar according to the setting parameters for setting the status bar color in the status bar modification function includes: Obtain the first color category information of the title bar of the page view to be displayed from the setting parameters of the status bar color setting function; Based on the first color category information, determine the color adaptation information for the status bar; Configure the color of the status bar based on the color adaptation information.

3. The method according to claim 1, characterized in that, The step of adjusting the status bar according to the setting parameters for setting the status bar color in the status bar modification function includes: Obtain the first color category information of the title bar of the page view to be displayed from the setting parameters of the status bar color setting function; Obtain the second color category information of the status bar, and determine the matching result of the color of the title bar and the color of the status bar based on the first color category information and the second color category information; When the color of the title bar does not match the color of the status bar, an operation is performed to adjust the color of the status bar according to the first color category information.

4. The method according to claim 1, characterized in that, The method further includes: When the view parameters meet the preset page size requirements and a call to the transition animation interface is detected, the operation of adding a subview is determined to be an operation of adding a page; the page size requirements refer to the preset size requirements for the page view.

5. The method according to claim 1, characterized in that, Before obtaining the view parameters corresponding to the view switching operation when it is determined that the view switching operation is an add subview operation, the method further includes: Respond to the overridden operation of the add subview method, and detect the add subview operation through the overridden add subview method.

6. The method according to claim 1, characterized in that, Also includes: Query whether a corresponding view controller exists based on the view identifier; When a view controller corresponding to the view identifier exists, the view switching operation is determined to be a page switching operation; Call the system settings status bar method in the corresponding view controller; The system's status bar setting method is hooked to call a preset custom status bar setting method to adjust the status bar and display the page with the adjusted status bar.

7. The method according to claim 1, characterized in that, Also includes: When the view switching operation is executed for the first time, a status bar modification record is generated based on the view identifier and the status bar adjustment method corresponding to the view switching operation, and the status bar modification record is stored in a preset variable array.

8. The method according to claim 7, characterized in that, After storing the status bar modification records into a preset variable array, the method further includes: In response to a page return operation, obtain the return page identifier corresponding to the page return operation; The corresponding status bar modification record is retrieved from the variable array based on the returned page identifier; Adjust the status bar according to the status bar modification record corresponding to the returned page identifier, and display the page with the adjusted status bar.

9. The method according to any one of claims 1-8, characterized in that, Also includes: Obtain the first address of the main thread object and the second address of the currently calling thread, wherein the currently calling thread is the thread that performs the adjustment of the status bar; When the first address is different from the second address, the adjustment of the status bar is executed in the main thread.

10. The method according to claim 1, characterized in that, Also includes: Receive page view adjustment parameters, which include page identifier, switching method, and status bar modification data; When the switching method is to add a view switch, store the page identifier and the status bar modification data; When the switching method is page switching, the view controller corresponding to the page switching is set according to the status bar modification data, and the page identifier and the view controller corresponding to the page switching are stored.

11. A status bar display control device, characterized in that, The device includes: The response module is used to respond to view switching operations and obtain the view identifier corresponding to the view switching operation. The acquisition module is used to acquire view parameters corresponding to the view switching operation when it is determined that the view switching operation is an add subview operation; the view parameters include the size of the view to be added, which is used to determine whether the add subview operation is an add page operation; The determination module is used to obtain the corresponding status bar modification function based on the view identifier when the operation of adding a subview is determined to be an operation of adding a page based on the view parameters; the status bar modification function is a function that modifies the status bar corresponding to the view to be displayed. The adjustment module is used to call a preset custom status bar setting method through the status bar modification function, and adjust the status bar according to the setting parameters of the status bar color in the status bar modification function so that the status bar color matches the color of the page view to be displayed, and display the page with the adjusted status bar.

12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 10.

13. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.

14. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.