问题
I have a login method that connects to a server to check the user info when the user clicks on the login button.
How can i block the view showing an activity indicator so that the user does not click on the button again?
回答1:
Why don't you just set the userInteractionEnabled
to false for the button?
btn.userInteractionEnabled = NO;
and set it back to YES after the login is completed?
You can set this property to every responsive UI element in the view you wish to disable.
BTW
This off-curse dose not prevent you from showing an activity indicator.
As always I love to recommend MBProgressHUD
EDIT If you are getting ARC errors do this:
- Select your target
- Look for the MBProgressHud.m file in the "Build Phases" -> "Compile Sources"
- add
-fno-objc-arc
in the Compiler Flags of the MBProgressHud.m file.
This will flash xCode not to compile this file with ARC.
来源:https://stackoverflow.com/questions/8628981/block-interface-until-operation-is-done