2015-11-04 50 views
0

我無法找到此'popover'的班級名稱。蘋果公司在他們的應用中使用了很多。這個popover課程的名字是什麼?

我已經搜索了popover,NSAlert,自定義隱藏/可見視圖等等。

它叫什麼?

enter image description here

+1

貌似UIAlertController – Leo

+0

的確,風格ActionSheet –

+0

的在Xcode中6 UIActionShit而現在的Xcode 7是UIAlertController增加了 「UIActionShit」 也 – Nilesh

回答

2

這是UIAlertController。在ios7之前,它被知道爲UIActionSheet

A UIAlertController對象向用戶顯示警報消息。這個類代替UIActionSheet和U​​IAlertView類來顯示警報。

@IBAction func showActionSheetTapped(sender: AnyObject) { 
    //Create the AlertController 
    let actionSheetController: UIAlertController = UIAlertController(title: "Action Sheet", message: "Swiftly Now! Choose an option!", preferredStyle: .ActionSheet) 

    //Create and add the Cancel action 
    let cancelAction: UIAlertAction = UIAlertAction(title: "Cancel", style: .Cancel) { action -> Void in 
    //Just dismiss the action sheet 
    } 
    actionSheetController.addAction(cancelAction) 
    //Create and add first option action 
    let takePictureAction: UIAlertAction = UIAlertAction(title: "Take Picture", style: .Default) { action -> Void in 
    //Code for launching the camera goes here 
    } 
    actionSheetController.addAction(takePictureAction) 
    //Create and add a second option action 
    let choosePictureAction: UIAlertAction = UIAlertAction(title: "Choose From Camera Roll", style: .Default) { action -> Void in 
    //Code for picking from camera roll goes here 
    } 
    actionSheetController.addAction(choosePictureAction) 

    //Present the AlertController 
    self.presentViewController(actionSheetController, animated: true, completion: nil) 
} 

輸出:

enter image description here

也許它會幫助你。

+0

做得好@Bhurnica –

+0

@rayjohn編碼愉快! – BHUMICA