我已经阅读了手册(https://material.io/develop/ios/components/buttons/),但仍然不明白如何去做。
class FloatingButtonController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let floatingButton = MDCFloatingButton()
floatingButton.setImage( UIImage(named: "plus"), for: .normal)
floatingButton.backgroundColor = .white
floatingButton.setElevation(ShadowElevation(rawValue: 6), for: .normal)
floatingButton.addTarget(self, action: #selector(btnFloatingButtonTapped(floatingButton:)), for: .touchUpInside)
self.view.addSubview(floatingButton)
}
@objc func btnFloatingButtonTapped(floatingButton: MDCFloatingButton){
floatingButton.collapse(true) {
floatingButton.expand(true, completion: nil)
}
}
}
我的项目在屏幕上。如您所见 - 屏幕上缺少该按钮。当您单击空白屏幕时会出现错误。
按钮触摸目标不符合 (48, 48) 的最小尺寸准则。按钮:>,触摸目标:{0, 0}
请告诉我,我做错了什么?我怎样才能得到这份工作呢?