Questions tagged [nsimageview]

An NSImageView object displays a single image from an NSImage object in a frame. An editable image view object behaves as an image well and supports copying, pasting, dragging, and using the Delete key to clear its content.

248 questions
6
votes
2 answers

What is the relationship between NSImageView and NSImageCell?

It seems that if I create an NSImageView in code, there is no way to have the image automatically scale proportionally up if the NSImageView becomes bigger than the image itself. (an odd omission) On the other hand, if I create the NSImageView in…
pizzafilms
  • 3,829
  • 4
  • 24
  • 39
5
votes
2 answers

Implement drag from NSImageView and save image to a file

I've studied Apple's example: CocoaDragAndDrop. I understand how to drag a image to NSImageView and drag an image between views. However, I still don't known how to drag an image and save it to a file when the image is dropped onto the Finder. Can…
phaibin
  • 379
  • 3
  • 9
5
votes
7 answers

Resize and Save NSImage?

I have an NSImageView which I get an image for from an NSOpenPanel. That works great. Now, how can I take that NSImage, half its size and save it as the same format in the same directory as the original as well? If you can help at all with anything…
Josh Kahane
  • 16,765
  • 45
  • 140
  • 253
5
votes
1 answer

NSImageView disappears when the parent NSView wants layer (setWantsLayer:YES)

I have a simple custom NSView that has a label and an image. Currently the view works quite well (all the thumbs are instances of my custom view): However, I want to set the opacity of these thumbnails. Setting viewInstance.layer.opacity doesn't…
Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
5
votes
1 answer

NSImageView size does not follow its window's

I'm just playing around with OSX app dev. I'm totally noob. I thought it is straight forward like iOS app dev. But after a few days of going at this, it seems it is not that easy. Here's what I'm trying to do. I have a NSWindow. In it in which I put…
GeneCode
  • 7,545
  • 8
  • 50
  • 85
5
votes
1 answer

Mac app not using retina @2x image files

I am trying to update my app to support retina displays but when it runs on a Retina MacBook Pro the @2x versions of the images aren't being used. Below are the methods I'm using in my app to set the image views. In the XML parser class: [[self…
wigging
  • 8,492
  • 12
  • 75
  • 117
4
votes
2 answers

Objective-C: Display an Array of Floats as an Image

In a Cocoa App I would like to display a 2d array of floats in an NSImageView. To make the code as simple as possible, start off by converting the data from float to NSData: // dataArray: an Nx by Ny array of floats NSMutableData *nsdata =…
Bruce Dean
  • 2,798
  • 2
  • 18
  • 30
4
votes
1 answer

NSImageView not working?

I am trying put an image in a view. This is my code: NSImageView *imView = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 480, 360)]; NSImage *myImage = [[NSImage alloc] initByReferencingFile:@"image.png"]; [imView setImage:myImage]; …
user635064
  • 6,219
  • 12
  • 54
  • 100
4
votes
1 answer

.aspectFill on NSImageView

I'm porting my SpriteKit app from iOS to MacOS. I am designing my main menu in the main.storyboard, and I have an image as the background. When I resize the window, however, my image does not fill the whole screen. I've…
4
votes
3 answers

Rotate NSImageView at its Center to Make it Spin

Swift 4, macOS 10.13 I have read a variety of answers on SO and still can't get an NSImageView to spin at its center instead of one of its corners. Right now, the image looks like this (video): http://d.pr/v/kwiuwS Here is my code: //`loader` is an…
Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128
4
votes
1 answer

macOS High Sierra and CAShapeLayers, NSImageView, NSTableView confilcts

I have updated to macOS High Sierra and have now unexpected problems in my project, the problems not seen before in macOS Sierra. I have custom NSImageView and after drag and drop of image in this NSImageView I can draw the rectangles on top of the…
VYT
  • 1,071
  • 19
  • 35
4
votes
0 answers

NSImageView Aspect Fit fix?

Can't believe there is no built-in Aspect Fit scaling method for the NSImageView class. I'm looking for the same behaviour as when using Preview.app with "Zoom to fit" turned on. Do I have to implement the scaling algorithm on my own or is there any…
riccardolardi
  • 1,713
  • 5
  • 20
  • 35
4
votes
3 answers

NSImageView ClipsToBounds

I have an iOS app that uses the code below. I am now creating the app for Mac OS X and would like the same effect however I do not seem to be able to use clipsToBounds. What should I be using? I have the rest of the code working on the Mac, just not…
Tom Coomer
  • 6,227
  • 12
  • 45
  • 82
4
votes
1 answer

NSImage from website URL

I need to create an NSImage from a url and then set it to an image view in my application. I tried some code I found online but it didn't work. If anyone knows how to do this any help would be great. Thanks
nosedive25
  • 2,477
  • 5
  • 30
  • 45
4
votes
2 answers

Adding blur to an NSImage using Swift

I'm searching for a way to add a blur effect to a NSImage using Swift. developing for iOS, UIImage provides a method like applyLightEffectAtFrame:frame ... but i could not find something equal for Cocoa/an OSX-App. edit 1: i tried to use…
ixany
  • 5,433
  • 9
  • 41
  • 65
1
2
3
16 17