MBProgressHUD不能立即显示问题

来源:互联网 发布:v380监控软件电脑版 编辑:程序博客网 时间:2024/05/16 02:19

今天使用HUD在tableview的代理方法didSelectRowAtIndexPath中使用HUD不能立即显示

这里写图片描述

问题原因

UIKit 不能在当前run loop结束前重画,即需要在下一个run loop 周期才能重画,更新UI。

解决方案

手动运行NSRunLoop
即:

// Setup and show HUD here[[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantPast]];// Insert your code here// Hide the shown HUD here