Swift UITableViewCell的button处展示p
作者:
喵喵粉 | 来源:发表于
2021-01-14 21:04 被阅读0次
-
sender
是UITableViewCell
上的UIButton
SelectTagCollectionVC
只有UICollectionView
fileprivate func showTags(sender: UIButton) {
let selectTagVC = SelectTagCollectionVC()
selectTagVC.preferredContentSize = CGSize(width: kScreenW, height: kScreenW/2)
selectTagVC.modalPresentationStyle = .popover
let popPC = selectTagVC.popoverPresentationController
popPC?.delegate = self
popPC?.sourceView = sender
popPC?.backgroundColor = .white
present(selectTagVC, animated: true) { }
}
- 实现代理
UIPopoverPresentationControllerDelegate
extension xxxVC: UIPopoverPresentationControllerDelegate {
///此处为不适配(如果选择其他,上面设置的大小就毫无意义了)
func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return .none
}
}
- 效果
image.png
本文标题:Swift UITableViewCell的button处展示p
本文链接:https://www.haomeiwen.com/subject/knijiktx.html
网友评论