objective c - How to draw a border around an NSTexturedSquareBezelStyle button -


i noticed other day 1 of web pages looking ugly. buttons on page looked totally different, based on whether contained 1 line of text or two.

after digging, i've learned typical button uses nsroundedbezelstyle, has fixed height. so, if text going wrap, firefox (and chrome , safari) change button use nsshadowlesssquarebezelstyle can have variable height. i'd petition maintainers of these browsers change , researching best alternative.

after finding already-filed bug , doing reading, suggested maybe use nstexturedsquarebezelstyle instead. turns out in mavericks looks same nsroundedbezelstyle button. same in yosemite, except has no border. changing setbordered has no effect.

so question, on behalf of browser developers everywhere: is possible draw nstexturedsquarebezelstyle button border? or, there way around browser vendors have missed?

rewritten answer

i'm not seeing nstexturedsquarebezelstyle button showing borderless in yosemite:

nstexturedsquarebutonstyle button under yosemite.

this stock button dragged palette in interface builder. encourage post code since it's you're generating button in code. here's own code generating same button:

nsbutton * anotherbutton = [[nsbutton alloc] initwithframe:nsmakerect(10.0, 10.0, 100.0, 100.0)]; anotherbutton.bezelstyle = nstexturedsquarebezelstyle; anotherbutton.title = @"line 1\nline 2"; 

proof:

same button created code.

if you're seeing different results under yosemite, you'll need post code. @ guess, might initializing button -init instead of -initwithframe:, can cause kinds of drawing issues since nsbutton nsview , therefore designated initializer -initwithframe:. guess though.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -