PUBLICROOTS

気になったことを紹介していきます!

Objective-C : アラート表示して自動的に閉じる方法

 

アラートの表示自体は簡単なのですが、自動的に閉じたい時の方法です。

 

//アラートの表示

UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"SAVE" 

                                                                        message:@"COMPLETE"

                                                                        delegate:self

                                                                        cancelButtonTitle:nil

                                                                        otherButtonTitles:nil ] autorelease];

[alert show];

//アラートを自動的に閉じる

[alert dismissWithClickedButtonIndex:0 animated:NO];

 

f:id:publicroots:20140506230131p:plain

 

参考サイト

【Objective-C】アラート(UIAlertView)を表示して自動的に閉じる方法 - creativi.tea

【Objective-C】アラートビューの使い方 - zakihayaメモ