回答:
うん、a UIAlertViewはおそらくあなたが探しているものです。次に例を示します。
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No network connection" 
                                                message:@"You must be connected to the internet to use this app." 
                                               delegate:nil 
                                      cancelButtonTitle:@"OK"
                                      otherButtonTitles:nil];
[alert show];
[alert release];もっと豪華なことをしたい場合、たとえばにカスタムUIを表示するUIAlertView場合は、サブクラス化UIAlertViewしてinitメソッドにカスタムUIコンポーネントを配置できます。UIAlertViewが表示された後にボタンを押すことに応答する場合は、delegate上記を設定して、- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndexメソッド。
もご覧くださいUIActionSheet。
この質問に来る人は、ポップアップボックスによって意味が異なります。Temporary Viewsのドキュメントを読むことを強くお勧めします。私の答えは、主にこれと他の関連ドキュメントの要約です。
アラートには、タイトルとオプションのメッセージが表示されます。続行する前に、ユーザーはそれを確認する(1ボタンのアラート)か、簡単な選択(2ボタンのアラート)を行う必要があります。でアラートを作成しますUIAlertController。
ドキュメントの警告と不要なアラートの作成に関するアドバイスを引用する価値があります。
ノート:
UIAlertView。ただし、iOS 8以降は非推奨です。UIAlertController今すぐアラートを作成するために使用する必要があります。アクションシートは、ユーザーに選択肢のリストを提供します。デバイスのサイズと向きに応じて、画面の下部またはポップオーバーに表示されます。アラートと同様に、a UIAlertControllerはアクションシートを作成するために使用されます。iOS 8以前UIActionSheetは使用されていましたが、今ではドキュメントに次のように記載されています。
重要:
UIActionSheetはiOS 8では非推奨です(UIActionSheetDelegateこれも非推奨であることに注意してください)。iOS8以降でアクションシートを作成および管理するには、代わりにofを使用UIAlertControllerします。preferredStyleUIAlertControllerStyleActionSheet
モーダルビューは、それがタスクを完了するために必要なすべてを持っている自己完結型の図です。全画面表示される場合とされない場合があります。モーダルビューを作成するにUIPresentationControllerは、モーダルプレゼンテーションスタイルのいずれかでを使用します。
こちらもご覧ください
A ポップオーバーは、それをオフタップしたときに何かにするとき、ユーザーのタップに表示され、消え図です。そこには、タップが行われたコントロールまたは場所を示す矢印があります。コンテンツは、View Controllerに配置できるほぼすべてのものにすることができます。でポップオーバーを作成しUIPopoverPresentationControllerます。(iOS 8より前UIPopoverControllerは、推奨される方法でした。)
これまで、ポップオーバーはiPadでしか利用できませんでしたが、iOS 8以降、iPhoneでも利用できます(ここ、ここ、およびここを参照)。
こちらもご覧ください
通知は、アプリがフォアグラウンドで実行されていない場合でも、ユーザーに何かを通知する音/バイブレーション、アラート/バナー、またはバッジです。
こちらもご覧ください
Androidでは、トーストは短いメッセージであり、画面に短時間表示された後、ユーザーによるアプリの操作を中断することなく自動的に消えます。
Androidのバックグラウンドを持つ人々は、iOSバージョンのToastが何であるかを知りたいと思っています。これらの質問のいくつかの例は、彼が見つかりましたことができ、ここで、ここでは、ここでは、とここに。答えは、iOSのトーストに相当するものはないということです。提示されているさまざまな回避策は次のとおりです。
UIViewただし、私のアドバイスは、すでにiOSに付属している標準のUIオプションを使用することです。アプリの外観と動作をAndroidバージョンとまったく同じにしようとしないでください。iOSアプリのように見えるように再パッケージする方法を考えてください。
iOS 8のリリース以降、UIAlertView非推奨になりました。UIAlertControllerが置き換えです。
Swiftでの表示例を以下に示します。
let alert = UIAlertController(title: "Hello!", message: "Message", preferredStyle: UIAlertControllerStyle.alert)
let alertAction = UIAlertAction(title: "OK!", style: UIAlertActionStyle.default)
{
    (UIAlertAction) -> Void in
}
alert.addAction(alertAction)
present(alert, animated: true)
{
    () -> Void in
}ご覧のとおり、APIを使用すると、アクションとアラートを表示するときの両方にコールバックを実装できます。これは非常に便利です。
Swift 4.2向けに更新
let alert = UIAlertController(title: "Hello!", message: "Message", preferredStyle: UIAlertController.Style.alert)
let alertAction = UIAlertAction(title: "OK!", style: UIAlertAction.Style.default)
        {
            (UIAlertAction) -> Void in
        }
        alert.addAction(alertAction)
        present(alert, animated: true)
        {
            () -> Void in
        }iOS 8.0向けに更新
iOS 8.0以降では、UIAlertControllerを次のように使用する必要があります。
-(void)alertMessage:(NSString*)message
{
    UIAlertController* alert = [UIAlertController
          alertControllerWithTitle:@"Alert"
          message:message
          preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction* defaultAction = [UIAlertAction 
          actionWithTitle:@"OK" style:UIAlertActionStyleDefault
         handler:^(UIAlertAction * action) {}];
    [alert addAction:defaultAction];
    [self presentViewController:alert animated:YES completion:nil];
}私の例では、自分自身がUIViewControllerであり、ポップアップの「presentViewController」メソッドを実装しています。
デビッド
Swift 3およびSwift 4の場合:
UIAlertViewは非推奨であるため、Swift 3でアラートを表示する良い方法があります
let alertController = UIAlertController(title: NSLocalizedString("No network connection",comment:""), message: NSLocalizedString("connected to the internet to use this app.",comment:""), preferredStyle: .alert)
let defaultAction = UIAlertAction(title:     NSLocalizedString("Ok", comment: ""), style: .default, handler: { (pAlert) in
                //Do whatever you want here
        })
alertController.addAction(defaultAction)
self.present(alertController, animated: true, completion: nil)非推奨:
これはチェックされた応答に触発された迅速なバージョンです:
AlertViewを表示:
   let alert = UIAlertView(title: "No network connection", 
                           message: "You must be connected to the internet to use this app.", delegate: nil, cancelButtonTitle: "Ok")
    alert.delegate = self
    alert.show()デリゲートをビューコントローラに追加します。
class AgendaViewController: UIViewController, UIAlertViewDelegateユーザーがボタンをクリックすると、次のコードが実行されます。
func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) {
}私はすでにさまざまな種類のポップアップの概要を書いていますが、ほとんどの人はアラートが必要です。
class ViewController: UIViewController {
    @IBAction func showAlertButtonTapped(_ sender: UIButton) {
        // create the alert
        let alert = UIAlertController(title: "My Title", message: "This is my message.", preferredStyle: UIAlertController.Style.alert)
        // add an action (button)
        alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
        // show the alert
        self.present(alert, animated: true, completion: nil)
    }
}