ios - changing NSButton CALayer hides its title -
ios - changing NSButton CALayer hides its title -
i'm trying alter button background way :
[table[i][j] setattributedtitle:attrstring]; [table[i][j] settitle:@"-"]; table[i][j].tag=i*10+j; table[i][j].frame = cgrectmake((i*30+40), (j*30+106), 30.0, 30.0); [self.mainview addsubview:table[i][j]]; calayer *buttonlayer = [calayer layer]; buttonlayer.contents=(id)[nsimage imagenamed:@"icaseinactiv"]; [table[i][j] setwantslayer:yes]; // view's backing store using core animation layer [table[i][j] setlayer:buttonlayer]; however, 1 time apply new layer, title disappears (the title still there when remove lastly line. doing wrong ?
thanks in advance
well i'm pretty sure nsbutton won't using layer default, drawing using normal [nsview drawrect:] method. added layer covers canvas , voilĂ , happens.
in order want need subclass nsbuttoncell reckon.
ios calayer nsbutton
Comments
Post a Comment