Questions tagged [nsview]

NSView Implements basic drawing, event handling and printing behaviors for applications. Usually application code define subclasses of NSView to provide richer implementations. Belongs to the Foundation framework for Cocoa and Cocoa Touch.

The NSView class defines the basic drawing, event-handling, and printing architecture of an app. You typically do not use NSView objects directly. Instead, you use objects whose classes descend from NSView or you subclass NSView yourself and override its methods to implement the behavior you need. For any view object, there are many methods that you can use as-is.

1639 questions
10
votes
2 answers

Overlay NSView over NSScrollView

I have an NSScrollView that fills an entire window and displays a huge image. Now I would like to overlay a custom NSView over parts of the Scroll View (eg. top 20 Pixels height and window width) to display additional information. As the user…
Robin
  • 8,197
  • 11
  • 45
  • 74
10
votes
2 answers

WKWebView Won't Load (NSViewController, OS X)

I am trying to build a simple WKWebView application that will display Google in the WebView. The app works perfectly fine; however, upon implementing the WKWebView, the app no longer shows a window. It just simply launches the app (in the dock) with…
JDev
  • 5,168
  • 6
  • 40
  • 61
10
votes
1 answer

NSVisualEffectView with mask has jagged corners

In one of the WWDC 2014 talks on the new Yosemite UI, it says to avoid the use of NSVisualEffectView in masked layers. Unfortunately my view's layer does have a shape mask, and as a result the visual effect view in it has an ugly jagged edge…
Luke
  • 4,908
  • 1
  • 37
  • 59
10
votes
2 answers

How to accept editing and dismiss pop-up menu containing custom view?

I want to add the ability to use a date picker when editing a particular column in my table view, and used the code snippet from here, which worked well. However NSDatePicker is not appropriate for my needs so I am using my own custom view, created…
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
10
votes
3 answers

Is there a robust way to detect first responder changes in subviews?

I'm building a custom view that contains several other subviews (NSTextField, WebView,...). I'd like to have my custom view draw a different border when one of the subviews is the first responder, and act as a single item that can be acted upon with…
Joseph North
  • 501
  • 4
  • 13
10
votes
1 answer

Reusable NSView from .xib

In several parts of my application, I need a control where a user can enter a password. The password field is secure, however I want the user to have the ability to switch the field to plain text and check for typos, etc. The password field itself…
TheNextman
  • 12,428
  • 2
  • 36
  • 75
10
votes
6 answers

In OSX 10.8 how do I constrain a subview to be the same size as its parent view

I have the default NSWindow created in a new application which has a single NSView. I then create a new NSViewController which has it's own XIB and a view. In the app delegate I do the obvious self.mainViewController = [[MainViewController alloc]…
ahwulf
  • 2,584
  • 15
  • 29
10
votes
2 answers

How to Get Current First Responder from Window Controller in Cocoa?

I would like to find the first responder view in a window. To do this, I would like to implement a category like this: @implementation NSView (ViewExtensions) - (NSView *)findFirstResponder { if ([self isFirstResponder]) { …
A A
  • 147
  • 1
  • 2
  • 8
10
votes
5 answers

Are layer-backed NSView siblings allowed to overlap?

I'm a little confused. The Apple Documentation states this: Note: For performance reasons, Cocoa does not enforce clipping among sibling views or guarantee correct invalidation and drawing behavior when sibling views overlap. If you want a view…
Johannes Fahrenkrug
  • 42,912
  • 19
  • 126
  • 165
9
votes
3 answers

Displaying AVPlayer content on two views simultaneously

I am creating an HTTP Live Streaming Client for Mac that will control video playback on a large screen. My goal is to have a control UI on the main screen, and full screen video on the secondary screen. Using AVFoundation, I have successfully been…
kcharwood
  • 2,501
  • 19
  • 22
9
votes
1 answer

Layer-backed OpenGLView redraws only if window is resized

I have a window with a main view of type NSView and a subview which is a subclass of NSOpenGLView whose name is CustomOpenGLView. The subclass of NSOpenGLView is obtained through a Custom View in Interface Builder and by setting its class to…
Andrea3000
  • 1,018
  • 1
  • 11
  • 26
9
votes
3 answers

Bad text rendering with Core Animation

First of all, I know this topic has been brought up several times before but I'm posting this question because none of the "solutions" I've used in the past have worked in this specific case. I'm drawing some text to a CALayer that is hosted by a…
indragie
  • 18,002
  • 16
  • 95
  • 164
9
votes
3 answers

How does an NSView subclass communicate with the controller?

I am brand spanking new to Cocoa programming, and am still kind of confused about how things wire together. I need a pretty simple application that will fire off a single command (let's call it DoStuff) whenever any point on the window is clicked.…
swilliams
  • 48,060
  • 27
  • 100
  • 130
9
votes
4 answers

How do I update a CALayer with a CVPixelBuffer/IOSurface?

I have an IOSurface-backed CVPixelBuffer that is getting updated from an outside source at 30fps. I want to render a preview of the image data in an NSView -- what's the best way for me to do that? I can directly set the .contents of a CALayer on…
andrew
  • 1,173
  • 2
  • 18
  • 28
9
votes
2 answers

Adding an NSProgressIndicator to the dock icon

I'm creating an application which should show a progress bar in the dock icon. Currently I have this, but it's not working: NSProgressIndicator *progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, 10.0f, 20.0f)]; …
user142019