markdown alertviewcontroller

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown alertviewcontroller相关的知识,希望对你有一定的参考价值。

## AlertViewController

1. Add below lines
  ```swift
      override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        tableView.deselectRow(at: indexPath, animated: true)
        let alertController = UIAlertController(title: "Hint", message: "You have selected row no \(indexPath.row) and section no \(indexPath.section)", preferredStyle: .alert)
        let alertAction = UIAlertAction(title: "OK", style: .cancel, handler: nil)
        alertController.addAction(alertAction)
        present(alertController, animated: true, completion: nil) // UITableViewDelegate
        
    }
  ```
  * Model Alert, it is displayed in the middle of screen and you have no of options to choose from
  * ActionSheet -> it comes from below the screen and have only two options
  * You can have different action after pressing button in 
  ```swift
  let restartAction = UIAlertAction(title: "Restart", style: .default, handler: { UIAlertAction in 
 self.startOver() 
}) 
  ```
  * Check AlertViewController additinal info on OneNote app
  

以上是关于markdown alertviewcontroller的主要内容,如果未能解决你的问题,请参考以下文章

未调用 alertviewcontroller 中的 tableview 的“cellForRowAtIndexPath”

解析中的 AlertViewController

自定义 AlertViewController 未在横向中正确显示

如何编辑 alertViewController 而不根据操作将其关闭

通过点击外部关闭 UIAlertViewController

将 ChildViewController 添加到 UIAlertController