Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. let image = NSImage(contentsOfFile: path as String);
  2.  
  3. class MyView: NSView {
  4.  
  5. override func draw(_ dirtyRect: NSRect) {
  6. super.draw(dirtyRect)
  7. let bounds = NSRect(x: 0, y: 0, width: 100, height: 100);
  8. let context = NSGraphicsContext.current()?.cgContext;
  9. context.draw(image: self.image!, in: bounds)
  10. }
  11. }
  12.  
  13. image!.draw(in: bounds);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement