MBProgressHUD icon indicating copy to clipboard operation
MBProgressHUD copied to clipboard

MBProgressHUD drawing dimmed background when hidden

Open fabianofrancesconi opened this issue 14 years ago • 4 comments

I noticed that the progress hud is rendering the background even when it's hidden.

I guess this is slowing performances for absolute no reason. What do you think is the smartest way to avoid this?

fabianofrancesconi avatar Oct 30 '12 13:10 fabianofrancesconi

I'm not sure what exactly you mean here. Could you be more specific?

matej avatar Nov 05 '12 14:11 matej

Yes. Consider this example: you create a view, you get a hud for that view using showHUDAddedTo. Next you get the same pointer to the hud using the HUDForView method, and then you issue a [hud hide];

At this point, if you rotate the screen of your device, the drawRect method in the MBProgressHUD is called and, if the dimBackground property is set to true, even the background is redrawn. This leads to slowdowns, especially when on retina displays on iPads.

fabianofrancesconi avatar Nov 05 '12 15:11 fabianofrancesconi

The problem is solved by setting the removeFromSuperViewOnHide to YES. It defaults to NO, which I find it to be somehow nonsense.

Still, glad to have a fix for this :)

fabianofrancesconi avatar Jul 02 '13 08:07 fabianofrancesconi

I have a huge lag because of never ending calls to drawRect: for dimmingView while scrolling my UICollectionView. removeFromSuperViewOnHide must be YES by default.

pronebird avatar Jul 21 '13 19:07 pronebird