从父母到孩子的迅速通过事件
我有2个类IE viewController
和baseViewController
我们已经完成了继承,我有疑问要通过事件从父母到子女而不是孩子,而不是父母。
class BaseViewController: UIViewController,UINavigationControllerDelegate,UIImagePickerControllerDelegate {
func openCamera() {
// open UIImagePickerController
}
// Delegates Methods of Image-picker controller
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]){
***My Question: //Pass Event to child class***
}
}
class ViewController: BaseViewController {
@IBAction func cameraButtonClicked(_sender: Any) {
self.openCamera()
}
}
提前致谢。
I have 2 classes i.e. ViewController
and BaseViewController
we have done with inheritance and i have question to pass event from Parent to child not child to parent.
class BaseViewController: UIViewController,UINavigationControllerDelegate,UIImagePickerControllerDelegate {
func openCamera() {
// open UIImagePickerController
}
// Delegates Methods of Image-picker controller
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]){
***My Question: //Pass Event to child class***
}
}
class ViewController: BaseViewController {
@IBAction func cameraButtonClicked(_sender: Any) {
self.openCamera()
}
}
THanks In advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您需要从父母发送挑选的图像到孩子的事件,然后您可以尝试
Suppose the event that you need to send picked image from the parent to the child , then you can try