objective c - Setting the cell on NSTextField -


i have custom nstextfieldcell want set on nstextfield.
if set on ib works fine.

enter image description here

and gets working this:

enter image description here

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:

enter image description here

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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -