Accessing IBOutlet of a controller in another class in COCOA

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I have a controller with a IBOutlet as follow :

@interface MyController : NSViewController <NSPopoverDelegate>
{
    IBOutlet NSWindow *detachedWindow;
}
@property (retain, nonatomic) NSWindow *detachedWindow;
@end

I want to access that outlet(detachedWindow) in a class that is: This subclass is added for a cell view in view based table view.

    @interface HoverTableRowView : NSTableRowView<NSTableViewDelegate,NSPopoverDelegate>   {
     __weak MyController *_delegateObject;
}

@implementation HoverTableRowView
@synthesize delegateObject = _delegateObject;
- (void)awakeFromNib
{
    NSLog(@"awake from nib is being called");
  NSLog(@"detached window outlet is--%@",[[self delegateObject ]detachedWindow]);

}
@end

But detached window outlet is-- is always returning null. How can I access that outlet in `HoverTableRowView class ?

Answers

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/18207031/accessing-iboutlet-of-a-controller-in-another-class-in-cocoa

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils