Open vjpr opened 10 years ago
One inconvenince to the above approach is that _tableView
is private.
@private
__unsafe_unretained QuickDialogTableView *_tableView;
Is there a reason for this being private instead of @protected
?
After more investigation it looks like I should be extending QAppearance
, and for my first example overriding:
[appearance buildHeaderForSection:section andTableView:(QuickDialogTableView*)tableView andIndex:index];
.
It would still be nice to extend the delegate nicely.
Workaround for extending @private _tableView
:
Define in your custom delegate:
# .h
@interface CustomDelegate : QuickDialogTableDelegate {
@private
__unsafe_unretained QuickDialogTableView *_myTableView;
}
@end
# .m
- (id <UITableViewDelegate, UIScrollViewDelegate>)initForTableView:(QuickDialogTableView *)tableView {
self = [super initForTableView:tableView];
if (self) {
_myTableView = tableView;
}
return self;
}
If I want to override some methods in the
QuickDialogTableDelegate
what is the best way to do this?For example I might like to create a custom header so I'll want to implement my own
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)index
method.What I am thinking about at the moment is:
Is the best way to set a custom delegate extending
QuickDialogTableDelegate
?