简体   繁体   中英

Can not override a method from super class

I tried to override two methods of a class named DKImagePickerControllerDefaultUIDelegate.

I was able to override the following method.

func layoutForImagePickerController(_ imagePickerController: DKImagePickerController) -> UICollectionViewLayout.Type

But I am unable to override this one.

func imagePickerController(_ imagePickerController: DKImagePickerController, didSelectAssets: [DKAsset])

DKImagePickerControllerDefaultUIDelegate is the link of class I was trying to subclass.

这是我要覆盖的方法。

Here is the issue I am getting when I tried to override the method.

我尝试覆盖时遇到的问题。

You class doesn't have super class. So override method will not work. I tried your given library and it will not work as per your given way. For basic understanding i have created same mimic structure here for you to easily understand.

protocol ATDelegate {
func handleUIChange() -> String
func didSelectAssets()
}

class ATCustomUIDelegate:ATDelegate{


func handleUIChange() -> String {
    return ""
}

func didSelectAssets() {

}
}

class ATOverrideCustomUIDelegate:ATCustomUIDelegate{

override func didSelectAssets() {

}
}

Above same case will applies with DKImagePickerControllerUIDelegate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM