hideLoading
Overview
hideLoading:options: hides the loading indicator that is currently being displayed.
This interface is typically used together with showLoading:options:, and is called after an asynchronous task completes, a request ends, or an error occurs, to dismiss the loading indicator on the page.
Type Declaration
objectivec
@interface SUDOPHideLoadingOptions : NSObject
@property(nonatomic, assign) BOOL noConflict;
@endMethod Declaration
objectivec
/**
Hides the currently displayed loading indicator.
@param stateHandle The state handle object that manages the operation state and callbacks.
@param options The options configuration for hiding the loading indicator (e.g., animated or not).
*/
- (void)hideLoading:(id<SUDOPStateHandle>)stateHandle
options:(SUDOPHideLoadingOptions *)options;Parameters
SUDOPHideLoadingOptions
| Parameter | Type | Required | Description |
|---|---|---|---|
noConflict | BOOL | No | Whether to enable the non-conflicting hide strategy. The actual behavior depends on the SDK implementation, and is typically used to avoid hiding a loading indicator being displayed by another business or another caller. |
Method Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
stateHandle | id<SUDOPStateHandle> | Yes | The state handle object, used to manage the current operation state and callbacks. |
options | SUDOPHideLoadingOptions * | Yes | The configuration object for hiding the loading indicator. |
Example
objectivec
id<SUDOPStateHandle> stateHandle = self.stateHandle;
SUDOPHideLoadingOptions *options = [[SUDOPHideLoadingOptions alloc] init];
options.noConflict = YES;
[self hideLoading:stateHandle options:options];Common Usage Together
objectivec
id<SUDOPStateHandle> stateHandle = self.stateHandle;
SUDOPShowLoadingOptions *showOptions = [[SUDOPShowLoadingOptions alloc] init];
showOptions.mask = YES;
showOptions.title = @"Loading...";
[self showLoading:stateHandle options:showOptions];
// Hide the loading indicator after the asynchronous task completes
SUDOPHideLoadingOptions *hideOptions = [[SUDOPHideLoadingOptions alloc] init];
hideOptions.noConflict = YES;
[self hideLoading:stateHandle options:hideOptions];Process Flow
- A loading indicator displayed via
showLoading:options:already exists in the current page or global environment. - The business side creates a
SUDOPHideLoadingOptionsobject. - Set
noConflictas needed. - Call
hideLoading:options:. - The SDK hides the loading indicator that is currently being displayed.
- The execution result or exception information is returned via the state callback.
Notes
hideLoading:options:should generally be called aftershowLoading:options:.stateHandleshould not be empty; otherwise the SDK may fail to correctly manage the current operation state or callbacks.optionsshould not be empty.- If there is no loading indicator currently being displayed, calling this method may not produce any visible effect.
- The exact semantics of
noConflictdepend on the actual SDK implementation; if the SDK supports multi-loading scenarios, this field may be used to avoid mistakenly hiding a loading indicator in another calling context. - It is recommended to call hide loading in all branches of an asynchronous task—success, failure, cancellation, etc.—to avoid a leftover loading indicator.
- This method has no synchronous return value; the hide result or exception information should be based on the SDK callback or state callback.
