NSButton subclass draws image backgrounds upside down.
| Originator: | todd.thomas | ||
| Number: | rdar://29361553 | Date Originated: | 22-Nov-2016 00:05 AM |
| Status: | Open | Resolved: | |
| Product: | macOS SDK | Product Version: | 10.11.6/10.12.1 |
| Classification: | Open | Reproducible: |
Summary:
I have some button subclasses that end up drawing their custom bezels/background images upside down. I wanted to create the simplest possible sample code that demonstrates the problem. I've included a sample project that demonstrates the issue.
Steps to Reproduce:
1. Open included sample xcodeproj.
2. Go to Assets.xcassets and click on 'ugly_button' image.
3. Note how it has some lines at the top of it.
4. Compile and run (on Xcoade 8.1)
5. Notice how both buttons draw the image upside down and now lines are at the bottom.
6.Check out each NSButton subclass. One draws in drawRect: and the other uses NSCell's drawWithFrame:inView:.
Expected Results:
Draw the image not flipped would be good. The workaround I found was to implement -(BOOL)isFlipped { return NO; } in my button subclass. But then you need to adjust the title since it gets moved too.
Actual Results:
Upside down drawing of images.
Version:
Xcode 8.1 8B62
Notes:
Configuration:
I tried this on my 10.11.6 Mac (15G1108) and 10.12 (16B2657)
Attachments:
'PopoverAndCustomButtons.zip' was successfully uploaded.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!