You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The result is the subclass delegate method will not be called. There is no button shown. This is not I expected.
And I test that if I add the function above at ParentVC and override in SubVC. Then it works.
In ParentVC
func buttonTitle(forEmptyDataSet _: UIScrollView, for _: UIControl.State) -> NSAttributedString? {
return nil
}
In SubVC
override func buttonTitle(forEmptyDataSet _: UIScrollView, for _: UIControl.State) -> NSAttributedString? {
return NSAttributedString(string: "Add")
}
It is strange that I need to implement the function into ParentVC which is useless to ParentVC. If I have many different subclass of ParentVC which has their own special handling. I have to add all those method on ParentVC first and override at subclass then.
The text was updated successfully, but these errors were encountered:
I think it's because I extend the EmptyDataSetSource to provide default implementations. Just like this question.
publicextensionEmptyDataSetSource{func buttonTitle(forEmptyDataSet scrollView:UIScrollView, for state:UIControl.State)->NSAttributedString?{returnnil}}
For example, a viewcontroller called ParentVC has implement EmptyDataSetSource with below delegate function.
Now, a viewcontroller called SubVC which inherited ParentVC. if I want to show a button when tableview is empty. I added this delegate method.
The result is the subclass delegate method will not be called. There is no button shown. This is not I expected.
And I test that if I add the function above at ParentVC and override in SubVC. Then it works.
It is strange that I need to implement the function into ParentVC which is useless to ParentVC. If I have many different subclass of ParentVC which has their own special handling. I have to add all those method on ParentVC first and override at subclass then.
The text was updated successfully, but these errors were encountered: