【发布时间】:2020-12-20 08:48:17
【问题描述】:
我创建了 SwipingController 应用程序。 该应用程序应该具有手势滚动功能和一个带有 2 个按钮和 UIPageControl 的管理栏。
目前,这些按钮本应仅在控制台中打印一条文本消息,但事实并非如此。
let nextButton: UIButton = {
let button = UIButton(type: .system)
button.setTitle("NEXT", for: .normal)
button.setTitleColor(.black, for: .normal)
button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 14)
button.addTarget(self, action: #selector(handleNextButton), for: .touchUpInside)
return button
}()
@objc func handleNextButton() {
print("Next Botton Pressed")
}
我想将整个页面管理栏添加到一个单独的文件中。
当它进入主控制器时,整个功能都会起作用。
我不想粘贴所有代码,所以它给出了 git 的链接
https://github.com/SebaKrk/SwipingControllerProgrammatic.git
【问题讨论】:
-
我看过你的项目。您的按钮位于 UICollectionViewCell 中。在使用单元格时,您应该考虑使用委托模式来处理操作。
-
好的,我将实现委托模式并传递到这里检查
标签: ios swift programmatic-config