Ok, więc mamy UIScrollView
deklarację:nieruchomość Delegat z innego typu w Swift
protocol UIScrollViewDelegate: NSObjectProtocol { ... }
class UIScrollView: UIView {
...
weak var delegate: UIScrollViewDelegate?
...
}
A potem UITableView
z delegate
wariantu?
protocol UITableViewDelegate: NSObjectProtocol, UIScrollViewDelegate { ... }
class UITableView: UIScrollView {
...
weak var delegate: UITableViewDelegate?
...
}
W jaki sposób Apple to zrobił? Kiedy robię mój
protocol MyScrollViewSubclassDelegate: NSObjectProtocol, UIScrollViewDelegate { ... }
class MyScrollViewSubclass: UIScrollView {
...
weak var delegate: MyScrollViewSubclassDelegate?
...
}
uzyskać Własność „delegata” typu 'MyScrollViewSubclassDelegate? nie można przesłonić właściwości z typem "UIScrollViewDelegate?".
Co, jeśli ustawisz swoją podklasę na UITableView. klasa MyScrollViewSubclass: UITableView – jarryd
Ten sam problem ... –
Czy próbowałeś rozszerzeń protokołu w Swift 2.0? – jarryd