In questions like this one it shows how to use UIKit's
-(UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight
to stretch a PNG easily, e.g when inserting text in an iChat like bubble. I would like to do the same on regular AppKit/Cocoa/desktop app using CoreGraphics or some NSImage related API but couldn't find an equivalent method. Does anybody know how to do this in AppKit?
Use NSDrawThreePartImage
or NSDrawNinePartImage
.
Just use -[NSImage drawInRect:fromRect:operation:fraction:], and pass NSZeroRect as the fromRect; parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With