Question

I currently have a project where I present a HUD using this control:

https://github.com/samvermette/SVProgressHUD

I present the SVProgress HUD over a complicated hierarchy of UIViews and ScrollViews.

SVProgressHUD is a bit like a UIAlertView, it presents a message but it auto dismisses itself.

In one part of my app, I am using it each time the user pops through a page in my UIScrollView.

The autodismiss feature is good but I want the user to be able to tap the hud and dismiss it early if required.

So I know SVProgressHUD posts a notification to notification center

SVProgressHUDDidReceiveTouchEventNotification

This is good, and what i've done is add a notification observer in my main viewController which calls a class method on SVProgressHUD to dismiss any presented HUD's when the SVProgressHUDDidReceiveTouchEventNotification is posted.

My problem (and question is) how can I ensure this dismiss method doesn't interfere with my scrollview?

I want my users to be able to quickly swipe through scrollview content pages, however since I started listening to this notification the scrollview doesn't react to the first touch of the user, it uses the first touch to dismiss the HUD. This feels quite clunky.

The problem is SVProgressHUDDidReceiveTouchEventNotification is being posted even if the HUD isn't touched and instead my Scrollview underneath is touched. How can I add a hittest inside my dismiss method to check that SVProgressHUDDidReceiveTouchEventNotification was posted because the HUD itself was touched?

Thanks!

Was it helpful?

Solution

I implemented touchesEnded in SVProgressHUD and handle touches there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top