根據🍎的文件
The
UIAlert Controller
class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.如果不想理他的話,就用以下的方法吧!
- 打開contentViewController的束縛@interface UIAlertController (ContentViewController)@property (nonatomic,retain) UIViewController * contentViewController;@end
- 呼喚神秘的contentViewControlleralertController.contentViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "contentViewController")
- 如果,使用tableview的話,記得加上override func viewWillLayoutSubviews() {super.viewWillLayoutSubviews()// make UITableView fit to content's sizeself.preferredContentSize = self.tableView.contentSize
}
code
沒有留言:
張貼留言