I have this code for changing the image of a button:
- (void)mouseEntered:(NSEvent *)event {
[self setImage:[NSImage imageNamed:@"FloatingButton_hover"]]; }
- (void)mouseExited:(NSEvent *)event {
[self setImage:[NSImage imageNamed:@"FloatingButton_normal"]]; }
But i have @2x images of these 2 in my resources. How do i know if the Mac has retina, so i can [self setImage:[NSImage imageNamed:@"FloatingButton_normal@2x"]]? Or is there any other way?
Thanks
You don’t have to do that. Just put your @2x versions in the same folder and Cocoa will take care of the rest. You can test if it’s actually working by going into HiDPI mode.
I recommend watching Introduction to High Resolution on OS X