, NSTableView. .
, NSTableView. , , NSTableView :
- (NSInteger)myRowNumber
{
return [(NSTableView*)self.superview.superview rowForView:self];
}
, . , , . :
- (NSInteger)myRowNumber
{
NSTableView* tableView = nil;
NSView* mySuperview = self;
do
{
NSView* nextSuper = mySuperview.superview;
if (nextSuper == nil)
{
NSException *exception =
[NSException exceptionWithName:@"NSTableView not found."
reason:[NSString stringWithFormat:@"%@ search went too deep.",
NSStringFromSelector(_cmd)] userInfo:nil];
@throw exception;
}
if ([nextSuper isKindOfClass:[NSTableView class]])
tableView = (NSTableView*)nextSuper;
else
mySuperview = mySuperview.superview;
} while (tableView == nil);
return [tableView rowForView:self];
}
NSTableView, , , , .
, IBOutlet , ( ). , , , . , , .
[self.myDoc doSomethingToRow:self.myRowNumber]
, NSTableView. (, , Apples).
, , , ,