当我从小部件(今天扩展名)单击时,KYDrawerController的侧菜单没有响应。但是当我直接从应用程序图标单击时,它可以工作。下面是我的代码。
func addDrawerMenuButton(){ self.navigationItem.leftBarButtonItem = UIBarButtonItem(图片:UIImage.menuImage(),样式:.plain,目标:自我,行动:#selector(self.drawerMenuButtonTapped)) }
@objc func drawerMenuButtonTapped() {
if let drawerController = self.navigationController?.parent as? KYDrawerController {
drawerController.setDrawerState(.opened, animated: true)
} else if let drawerController = self.navigationController?.presentingViewController as? KYDrawerController {
drawerController.setDrawerState(.opened, animated: true)
}
}