I know how to add any Custom UI inside UIAlertView by using accessoryView like UITableView but I am now curious that if w
Here's @Syed Ali Salman's answer in simplified form in Swift:
let alertController = UIAlertController(title: "The Title",
message: "Here's a message.",
preferredStyle: .Alert)
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel)
{ (action) in
// ...
}
alertController.addAction(cancelAction)
let okAction = UIAlertAction(title: "OK", style: .Default)
{ (action) in
// ...
}
alertController.addAction(okAction)
let tableViewController = UITableViewController()
tableViewController.preferredContentSize = CGSize(width: 272, height: 176) // 4 default cell heights.
alertController.setValue(tableViewController, forKey: "contentViewController")
yourTopViewController().presentViewController(alertController, animated: true)
{
// ...
}