【发布时间】:2017-12-07 07:32:58
【问题描述】:
我创建了一个 UICollectionView,其中包含名为 baseCell 的单元格。在这些单元格内部是另一个 UICollectionView,其中包含名为 subCell 的单元格。每个subCell 的内部都是一个UIButton。按钮有
这是设置按钮及其操作的代码:
let openOptionsButton: UIButton = {
let button = UIButton()
button.setImage(#imageLiteral(resourceName: "CircleAdd"), for: .normal)
button.addTarget(self, action: #selector(slideOverToOptions), for: .touchUpInside)
button.contentMode = .scaleAspectFit
return button
}()
func slideOverToOptions() {
print("This is working")
}
func setupViews(){
addSubview(openOptionsButton)
_ = openOptionsButton.anchor(topAnchor, left: nil, bottom: nil, right: rightAnchor, topConstant: 8, leftConstant: 0, bottomConstant: 0, rightConstant: 12, widthConstant: 48, heightConstant: 48)
}
当我按下按钮时,它不打印。我该如何解决这个问题?
【问题讨论】: