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
9
votes
3 answers

CABasicAnimation to make NSView flip

I'm making a card game for mac and I'm using a CABasicAnimation to making the card flip around. It's almost working, but it could be a bit better. As it works now, the card flips inwards (to the left) - Screenshot 1. When the card has moved…
Holger Sindbaek
  • 2,278
  • 6
  • 41
  • 68
9
votes
2 answers

Center an NSView within an NSScrollView

How do I center an NSView within an NSScrollView like the way "Preview" does?
rhombus
  • 145
  • 1
  • 6
9
votes
1 answer

Make NSWindow truly the highest level (above mouse, above mission control/expose)

I was wondering if it is possible to make my NSWindow show above absolutely everything. I current set the window level to CGShieldingWindowLevel using the code... [self setLevel:CGShieldingWindowLevel()]; ...and this does a great job for the most…
Atlas Wegman
  • 569
  • 2
  • 10
9
votes
1 answer

How to make NSView not clip its bounding area?

I created an empty Cocoa app on Xcode for OS X, and added: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { self.view = [[NSView alloc] initWithFrame:NSMakeRect(100, 100, 200, 200)]; self.view.wantsLayer = YES; …
Jeremy L
  • 3,770
  • 6
  • 41
  • 62
9
votes
4 answers

Is it possible to observe -visibleRect

I would like to be notified whenever a certain NSView's - (NSRect)visibleRect changes because I want to do some fancy subview layout based on the visible rect. Frankly, right now I'm stumped; -visibleRect doesn't emit KVO notifications (which makes…
Vervious
  • 5,559
  • 3
  • 38
  • 57
8
votes
0 answers

How can I get an NSView to resize to fit the desired sizes of its subviews using Auto Layout?

I have a superview with three subviews. Two of those subviews are fixed in size and position within the superview, but the third can vary in size depending on its contents. I have set up auto layout constraints to set the size and position of each…
DougC
  • 950
  • 7
  • 18
8
votes
1 answer

Redrawing an NSView

Sorry if this has been asked before or it's a really dumb question, but I can't figure it out. I have an NSView in my interface, and I have created a subclass of NSView in Xcode. Then using the identity inspector, I set my NSView's class to be the…
thekmc
  • 516
  • 5
  • 14
8
votes
1 answer

Quicklook embedded preview

From the docs for quicklook: "The consumer portion of Quick Look has three components: a document reader (consisting of a custom view and panel), display bundles for that reader, and an SPI to enable communication with the client. Each…
SG1
  • 81
  • 1
  • 3
8
votes
3 answers

Swift 3 Load xib. NSBundle.mainBundle().loadNibNamed return Bool

I was trying to figure out how to create a custom view using xib files. In this question the next method is used. NSBundle.mainBundle().loadNibNamed("CardView", owner: nil, options: nil)[0] as! UIView Cocoa has the same method,however, this method…
Alexei
  • 511
  • 1
  • 10
  • 22
8
votes
3 answers

Repeating background image in an NSView

I am trying to draw a repeating background image in my NSView, I have this till now: // INIT - (id)initWithFrame:(NSRect)frame { if (self = [super initWithFrame:frame]) { self.backgroundImage = [NSImage imageNamed:@"progressBackground.pdf"]; …
user142019
8
votes
2 answers

Cocoa: Does there exist an NSView with user resize capability?

I want an NSView that can be resized by dragging its the bottom right corner around, just like an NSWindow. I want to be able to embed this NSView into a parent NSView. Is there a component like this in Cocoa or any of its extensions?
Max
  • 1,203
  • 1
  • 14
  • 20
8
votes
1 answer

OSX: Objects inside view based table views may only be connected to to the table view's delegate

I have setup a NSView with an embedded NSTableView. I have tried to set an action for the NSTableViewCell to run when a change is made to the Table View Cell: import Cocoa class MyView: NSView { override func drawRect(dirtyRect: NSRect) { …
iphaaw
  • 6,764
  • 11
  • 58
  • 83
8
votes
1 answer

Can't turn off clipping of NSView instances created in Interface Builder

I am unable to figure out how to turn off subview/sublayer clipping when my custom view is defined in Interface Builder. When I create the view programmatically, and do the setup found in many questions here on StackOverflow, it works fine for both…
Eric apRhys
  • 316
  • 2
  • 7
8
votes
1 answer

Erratic behaviour with layer backed/layer hosting NSViews

I have a view hierarchy that looks like this: So basically I have an NSSplitView with a subview that contains a scroll view (for a table view) as well as a footer view that contains 3 subviews. Some important things to note: Uses the 10.8 base…
indragie
  • 18,002
  • 16
  • 95
  • 164
8
votes
1 answer

NSMenu animations block main thread

I have: NSStatusItem with a custom view (scrolling text in a secondary thread), with the secondary thread updating the internal state and notifying the main thread with setNeedsDisplay. On mouseDown, an NSMenu pops up. However, if any NSMenuItem in…
tentonwire
  • 81
  • 1