Advertise here

Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

make a triangular NSButton

dickthedevdickthedev Posts: 214Registered Users @ @

I am hoping to create a triangular shape NSButton, but I can not find any tutorial about it. Most of them are for UIButton, there seems to be quite a bit of differences in UIButton verse NSButton. Does anyone have suggestions in making custom NSButton? Thx.


  • voidzonevoidzone europePosts: 54Registered Users @
    Subclass NSButton and override the drawRect: method. There draw your triangle.

    Then override mouseDown:/mouseUp: and perform a check if the click occurred within the triangle. If yes handle it (either do action dispatch yourself or delegate to super).

    PS: don't forget to return NO in isOpaque to make the part of the button you're not drawing transparent.
    rep_icns.png Miss Appviz 2? Try Suborbital Reports. App Store report aggregation and analytics for your Mac.
Sign In or Register to comment.