阻塞接口,直到操作完成 [英] Block interface until operation is done

查看:145
本文介绍了阻塞接口,直到操作完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个连接到服务器的登录方法,以便在用户点击登录按钮时检查用户信息。



如何阻止显示

解决方案

为什么不设置 userInteractionEnabled 为该按钮的false?

  btn.userInteractionEnabled = 

并在登录完成后将其设置为YES?



您可以将此属性设置为要禁用的视图中的每个响应式UI元素。



BTW



这种禁用剂量不会阻止您显示活动指示符。



像往常一样,我喜欢推荐 MBProgressHUD



EDIT
如果您收到ARC错误,请执行以下操作:


  1. 选择您的目标

  2. 在Build Phases - >编译源代码中创建MBProgressHud.m文件

  3. 在编译器中添加 -fno-objc-arc


  4. 这将使xCode不会使用ARC编译此文件。


    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?

    解决方案

    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:

    1. Select your target
    2. Look for the MBProgressHud.m file in the "Build Phases" -> "Compile Sources"
    3. add -fno-objc-arc in the Compiler Flags of the MBProgressHud.m file.

    This will flash xCode not to compile this file with ARC.

    这篇关于阻塞接口,直到操作完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆