vignesh TN vignesh TN - 1 year ago 261
Swift Question

How to add UITableView in a UIAlertView in swift

How do I dynamically add UITableView in UIAlertView. After adding subView of UIAlertView to UITableView it is not displayed.

override func viewDidLoad() {
tableView.frame = CGRectMake(0, 50, 320, 200);
tableView.delegate = self
tableView.dataSource = self
tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")

@IBAction func textFieldCliked(sender: AnyObject) {
alertView.message = "table view"

Answer Source

I dont think you can do that with UIAlertView, but you can make a small View and present it modally or something like UIPopoverPresentationController