NSImage drawInRect:fromRect:operation:fraction results in a flipped image
cocoa, objective-c
Solution
Use the method
- (void)drawInRect:(NSRect)dstSpacePortionRect
fromRect:(NSRect)srcSpacePortionRect
operation:(NSCompositingOperation)op
fraction:(CGFloat)requestedAlpha
respectFlipped:(BOOL)respectContextIsFlipped
hints:(NSDictionary *)hints
along with `- (void)lockFocusFlipped:(BOOL)flipped`
to draw the image upside down. From the NSImage Reference manual.
Problem
When I use: ``` [iconImage drawInRect:NSMakeRect(cellFrame.origin.x+5,yOffset+3,cellFrame.size.height-6, cellFrame.size.height-6) fromRect:NSMakeRect(0,0,[iconImage size].width, [iconImage size].height) operation:NSCompositeSourceOver fraction:1.0]; ``` to draw some images in the NSOutlineView cells, the images are vertically flipped upside down. How can I fix it ? Thanks