Block interface until operation is complete

I have a login method that connects to the server to check user information when the user presses the login button.

How to block the view showing the activity indicator so that the user does not click the button again?

0
source share
1 answer

Why don't you just set userInteractionEnabled to false for the button?

 btn.userInteractionEnabled = NO; 

and return it to YES after completing the login?

You can set this property for each sensitive user interface element in the view that you want to disable.

BTW

This curse dose does not stop you from showing an activity indicator.

As always, I like to recommend MBProgressHUD

EDIT If you get ARC errors, do the following:

  • Choose a target
  • Locate the MBProgressHud.m file under Phase Assembling → Compile Sources
  • add -fno-objc-arc to the compiler flags of the MBProgressHud.m file.

This will launch xCode so as not to compile this file using ARC.

+2
source

Source: https://habr.com/ru/post/920582/


All Articles