objective c - How to call super class delegate method from subclass delegate method in Cocoa? -
there example class:
@interface outlineviewcontroller : nsoutlineview <nsoutlineviewdatasource, nsoutlineviewdelegate> @end @implementation outlineviewcontroller - (nsview *)outlineview:(nsoutlineview *)outlineview viewfortablecolumn:(nstablecolumn *)tablecolumn item:(id)item { nstablecellview *result = nil; if (mycondition) { // ... return result; } else { // how return defult? } } @end
is there possibility call default realization delegate method?
just use super
keyword refer parent class you've done in comment:
if (mycondition) { //...your implementation here } else { return [super outlineview:outlineview heightofrowbyitem:item]; }
for points, might use -respondstoselector:
check super
responds method in question.
update: noticed superclass in case nsoutlineview
itself. quite confusing -- views , view controllers different things, calling descended view "view controller" not plan. also, note docs advise "subclassing nsoutlineview not recommended."
nevertheless, think understand question better -- think "default realization" mean not inherited version of delegate method, behavior outline view use if delegate method weren't implemented @ all. in case, answer pretty simple: can nsoutlineview
do. documentation -outlineview:heightofrowbyitem:
says:
implement method support outline view varying row heights.
for fixed row heights, on other hand, nsoutlineview
uses rowheight
property inherits nstableview
. so, can return rowheight
in cases when don't want change row height:
if (mycondition) { //...your implementation here } else { return outlineview.rowheight; }
Comments
Post a Comment