Summarize code for the three presentation experiments

Image Picker Controller

@IBAction func experiment() {
    let controller = UIImagePickerController()        
    self.presentViewController(controller, animated: true, completion: nil)
}

Activity View Controller

   
@IBAction func experiment() {
    let image = UIImage()
    let controller = UIActivityViewController(activityItems: [image], applicationActivities: nil) 
    self.presentViewController(controller, animated: true, completion: nil)
}

Alert View Controller

@IBAction func experiment() {
    let controller = UIAlertController()
    controller.title = "Test alert"
    controller.message = "This is a test"

    // Dismiss the view controller after the user taps “ok”    
    let okAction = UIAlertAction (title:"ok", style: UIAlertActionStyle.Default) {
        action in self.dismissViewControllerAnimated(true, completion: nil)
    }
    controller.addAction(okAction) 
    self.presentViewController(controller, animated: true, completion:nil)
}
posted @ 2015-08-15 21:07  dagon  阅读(224)  评论(0编辑  收藏  举报