showLoading
Overview
showLoading:options: displays a loading indicator to the user, typically shown as a progress HUD.
The caller can use SUDOPShowLoadingOptions to configure the loading prompt text and whether to show a transparent mask layer. When a mask layer is set, user taps on content behind the indicator can be blocked while the loading indicator is displayed, to avoid duplicate operations or accidental taps.
Type Declaration
objectivec
/**
Options for configuring loading indicator (progress HUD) display behavior.
*/
@interface SUDOPShowLoadingOptions : NSObject
/**
Whether to show a transparent mask layer to prevent touch-through events.
When set to YES, user interactions behind the loading indicator are blocked.
*/
@property(nonatomic, assign) BOOL mask;
/**
The text title to be displayed alongside the loading indicator.
(e.g., "Loading...", "Please wait...")
*/
@property(nonatomic, strong) NSString *title;
@endMethod Declaration
objectivec
/**
Displays a loading indicator (progress HUD) to the user.
@param stateHandle The state handle object that manages the operation state and callbacks.
@param options The options configuration for the loading indicator (e.g., text, style, mask type).
*/
- (void)showLoading:(id<SUDOPStateHandle>)stateHandle
options:(SUDOPShowLoadingOptions *)options;Parameters
SUDOPShowLoadingOptions
| Parameter | Type | Required | Description |
|---|---|---|---|
mask | BOOL | No | Whether to show a transparent mask layer. When set to YES, user taps on the page content behind the indicator are blocked while the loading indicator is displayed. |
title | NSString * | No | The loading prompt text, e.g., Loading... or Please wait.... |
Method Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
stateHandle | id<SUDOPStateHandle> | Yes | The state handle object, used to manage the current operation state and callbacks. |
options | SUDOPShowLoadingOptions * | Yes | The loading indicator configuration object, containing the prompt text, mask layer, and other settings. |
Example
objectivec
id<SUDOPStateHandle> stateHandle = self.stateHandle;
SUDOPShowLoadingOptions *options = [[SUDOPShowLoadingOptions alloc] init];
options.mask = YES;
options.title = @"Loading...";
[self showLoading:stateHandle options:options];Process Flow
- The business side creates a
SUDOPShowLoadingOptionsobject. - Set the loading prompt text
titleaccording to business needs. - Set whether to show the transparent mask layer
maskaccording to business needs. - Call
showLoading:options:to display the loading indicator. - The SDK displays the loading indicator on the current page or the specified container.
- After loading completes, the business side should call the corresponding hide loading interface to dismiss the loading indicator.
Notes
stateHandleshould not be empty; otherwise the SDK may fail to correctly manage the current operation state or callbacks.optionsshould not be empty.titlecan be empty; when empty, the SDK may show only the loading animation, depending on the SDK implementation.- When
maskis set toYES, it can prevent the user from continuing to tap the page content during loading. - When
maskis set toNO, the page behind the loading indicator may still respond to user interactions. showLoading:options:typically needs to be used together with the hide loading interface, to avoid the loading indicator remaining on the page for a long time.- If this method is called multiple times in a short period, the SDK may update the existing loading indicator or stack multiple indicators, depending on the SDK implementation.
- This method has no synchronous return value; the display state or exception result should be based on the SDK callback or state callback.
