views:

122

answers:

1

I have a situation where I would like to pop up an alert view, but the event that shows the alert view could occur as often as every 5 seconds. I'd rather not have a stack of alert views for the user to click OK on so I was wondering.

How do you check if a UIAlertView is currently showing?

+1  A: 

You could retain a reference to it or you could set a flag in your alert delegate. When you open the alert set the flag to true and when the alert calls its dismissal delegate function flip it to false. Check the state of the flag to determine whether an alert is currently open.

If you think it even possible you could end up with a stack of alerts you might want to rethink your design. Your users will not like being hit with alert dialog after alert dialog.

TechZen