如何快速在 UIAlertView 中添加 UITableView [英] How to add UITableView in a UIAlertView in swift
本文介绍了如何快速在 UIAlertView 中添加 UITableView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 UIAlertView 中动态添加 UITableView.将 UIAlertView 的 subView 添加到 UITableView 后不显示.
How do I dynamically add UITableView in UIAlertView. After adding subView of UIAlertView to UITableView it is not displayed.
override func viewDidLoad() {
super.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"
alertView.addButtonWithTitle("Ok")
alertView.addSubview(tableView)
alertView.show()
}
推荐答案
我不认为你可以用 UIAlertView
做到这一点,但你可以制作一个小视图并以模态方式呈现它或类似 UIPopoverPresentationController
I dont think you can do that with UIAlertView
, but you can make a small View and present it modally or something like UIPopoverPresentationController
这篇关于如何快速在 UIAlertView 中添加 UITableView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文