开发者

Handling multiple alert views in iPhone/iPad application

I am working on an application that involves communication between two devices.

When device#1 seeks to communicate with device#2, it first sends a request message. Upon receiving the message, device#2 informs the user that a person wishes to communicate with it. If the user is interested in receiving the data, he choses Yes otherwise he chooses No. This is all very straightforward implementation and is working good.

Device#1 also have an option to cancel the communication. If it wishes to cancel, we send an appropriate the message to device#2 informing that the communication is cancelled. Device#2 should inform the user that the communication has been cancelled at device#1.

The problem is with the use case where device#1 requests for communication and devi开发者_如何学Cce#2 didn't respond yet. If device#1 sends a cancellation message, that's displayed as an alert to teh user. So, device#2 will now have 2 alerts, one asking for confirmation and the other about cancellation. Cancellation alert is displayed to the user. When he taps on OK, the app still asks for his confirmation to communicate. It should not ask for the confirmation as the communication is already canceled by device#1 and the same is notified to the user as well.

I am trying to find a way to programmatically close confirmation alert when we get the cancellation alert.

Can you please help me find a way to solve this?

Thanks in advance.

-Murali

Right now requires me to present an alert view to ask for user's confirmation before the main even stards.


Assuming your alert is a UIAlertView, you can use this method to remove it.

- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated

And then show the new UIAlertView where it says that communication has been cancelled.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜