如何在 UIAlertController 上添加 UIView

How to add UIView on UIAlertController

我们如何在 UIAlertController 上添加 UIView,就像我们可以使用 @"AccessoryView" 在 UIAlertView 上做的那样,但现在它在 iOS 8 中已弃用。 所以我想将它与 UIAlertController 一起使用,但如何使用?

您可以子类化 UIViewController 并制作 CustomAlertViewController 并使用 presentViewController 来显示它。

作为参考,您可以查看此 link。它仅适用于 iOS 8。

试试下面的东西,

var alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.ActionSheet);
alert.view.addSubview([YOUR CUSTOMR VIEW]);

希望对您有所帮助..

您可以在 UITableViewCell 上添加 UITableView,也可以在 UITableviewCell 上添加 CollectionView。 您必须根据单元格索引在单元格 classes 内指定数据源。

在 - (void)awakeFromNib 函数中注册子单元格笔尖

[self.collectionView registerNib:[UINib nibWithNibName:@“childCollectnCell” bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@“childCollectnCell”]

并在 class

中指定数据源和委托