jdg / MBProgressHUD

MBProgressHUD + Customizations
http://www.bukovinski.com/
MIT License
16.01k stars 3.56k forks source link

An automatically change of content offset when use MBProgressHUD in a horizontal scrollable UICollectionView #403

Closed Cookiezby closed 8 years ago

Cookiezby commented 8 years ago

I use MBProgressHUD in my custom UICollectionView.

UIView ->UICollectionView (only horizontal scrollable ) ->UICollectionViewCell (full-screen) ->UIScrollView (full-screen)

I add the HUD in the UIView when I want to show it. And I will show the HUD view multiple times, However, when I showed the HUD the second or third times, after the HUD dismiss, the content offset will change to the content offset where I first show the HUD instantly.

cell1===cell2===cell3===cell4

when I show the hud in cell3 first time, and it dismiss.Then I show the hud in cell1, after the hud dismiss, the content offset of the UICollectionView will be set to the position of cell3 instantly.

Sorry for my poor english, thanks.

Cookiezby commented 8 years ago

And It is fixed if I add the hud to cell instead of self.view.

Could you tell me why this will happen?

matej commented 8 years ago

I don't really understand what you are doing, but as a general rule you should not add the HUD directly to a UICollectionView. You are not in charge of the subview handling there and unexpected things might happen.

Cookiezby commented 8 years ago

Thank you for your answer