objective c - Problems linking NSTableView handler class -


i have strange problem in cocoa-app. have main window nstableview in controller class (propvaltablehandler). have made connections between nstableview , propvaltablehandler, when 'numberofrowsintableview' method called looks not 'propvaltablehandler' initialized in 'adddelegate' used, since 'propman' field not initialized (it normal init used, has instance of class). doing wrong? have nstableview handler in window, works, not have custom init method.

source codes:

appdelegate

#import "appdelegate.h"  @implementation appdelegate  @synthesize propvaltablecontroller = _propvaltablecontroller;  -(id) init {     self = [super init];      if (self)     {         _propman = [[ocpropertymanager alloc]initwithpath:"./data/"];         _propvaltablecontroller = [[propvaltablehandler alloc]                                     [initwithpropmanager:_propman];     }      return self; } 

propvaltablehandler

@interface propvaltablehandler : nsobject <nstableviewdatasource>  @property iboutlet nstableview * constants; @property ocpropertymanager    * propman;  -(id) initwithpropmanager:(ocpropertymanager*)pm;  -(nsinteger) numberofrowsintableview:(nstableview *)tableview;  @end   #import "propvaltablehandler.h"  @implementation propvaltablehandler   -(id) initwithpropmanager:(ocpropertymanager*)pm {     self = [super self];     if (self)     {         self.propman = pm;     }      return self; }  /*********** tableview datasource ******************/ -(nsinteger) numberofrowsintableview:(nstableview *)tableview {     nsinteger count = [_propman.consts count];     return count; } /**************************************************/  @end 

i have solved problem adding

@property iboutlet appdelegate *parent; 

for propvaltablehandler class , making connections. way can use:

parent.propman 

where ever need without passing reference in init method.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -