开发者

Dismissing a UIAlertView

I put an in app purchase into my app, and when the user taps a button, the purchase is started. So basically, they tap the button, and then depending on the speed on their Internet connection, they could be waiting for up to ten seconds until a new alert view comes up asking if they would like to buy the product. The user will probably tap the button multiple times since nothing came up, and then multiple purchase alert views will come up. Additionally, this could maybe be seen by the user as an app bug. In the end, this is a problem.

I want an alert view to come up with a spinning wheel that says "Loading..." when the users taps the buy bu开发者_高级运维tton. Now my problem is, how do I get that to dismiss when the new alert view comes up asking the user if they want to buy the product?

if ([UIAlertView alloc] that says: @"whatever Apple's alert view says")
{ 
      //dismiss the "Loading..." alert view here
}

I doubt that would work, so any input is appreciated. Thanks!


You need to have access to that alertview. You can do this. Create a alertview instance var in app delegate and when you want to show loading initialize that instance var assign to your property and when you want to dismiss just call

[alertViewinstance dismissWithClickedButtonAtIndex:0];

Write this piece of code in a method in appDelegate. Hope you get the idea. If not let me know I'll post the sample code here.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜