objective c - Setting the cell on NSTextField -
i have custom nstextfieldcell want set on nstextfield.
 if set on ib works fine.

and gets working this:

but want set programmatically , try this:
-(void)awakefromnib{      nsrect therect = nsrectfromcgrect( nsmakerect(50, 100, 100, 100));     nstextfield *inputfield = [[nstextfield alloc] initwithframe:therect];     drkhudtextfieldcell *thec = [[drkhudtextfieldcell alloc] inittextcell:@"textfield"];     [inputfield setcell:thec];      [[_window contentview] addsubview:inputfield];      }     this result get:

what going wrong? code bad or what?
try way, working fine:
 nsrect therect = nsrectfromcgrect( nsmakerect(50, 100, 100, 100));      nstextfield *inputfield = [[nstextfield alloc] initwithframe:therect];      nstextfieldcell *thec = [[nstextfieldcell alloc] inittextcell:@"textfield"];      [inputfield setcell:thec];      [inputfield setbordered:yes];      [inputfield setbackgroundcolor:[nscolor whitecolor]];      [inputfield setbezeled:yes];      [inputfield setbezelstyle:0];     [[_window contentview] addsubview:inputfield];      
Comments
Post a Comment