Skip to content

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;

@end

Method 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 ​

ParameterTypeRequiredDescription
maskBOOLNoWhether 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.
titleNSString *NoThe loading prompt text, e.g., Loading... or Please wait....

Method Parameters ​

ParameterTypeRequiredDescription
stateHandleid<SUDOPStateHandle>YesThe state handle object, used to manage the current operation state and callbacks.
optionsSUDOPShowLoadingOptions *YesThe 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 ​

  1. The business side creates a SUDOPShowLoadingOptions object.
  2. Set the loading prompt text title according to business needs.
  3. Set whether to show the transparent mask layer mask according to business needs.
  4. Call showLoading:options: to display the loading indicator.
  5. The SDK displays the loading indicator on the current page or the specified container.
  6. After loading completes, the business side should call the corresponding hide loading interface to dismiss the loading indicator.

Notes ​

  • stateHandle should not be empty; otherwise the SDK may fail to correctly manage the current operation state or callbacks.
  • options should not be empty.
  • title can be empty; when empty, the SDK may show only the loading animation, depending on the SDK implementation.
  • When mask is set to YES, it can prevent the user from continuing to tap the page content during loading.
  • When mask is set to NO, 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.