nsview

Automatic NSView resizing.

Hi there. I'm doing something with cocoa which I think is a bit complicate for a beginner like me. I tried a few things, but I admit I need some theory first, because I would like to understand exactly the meaning of this concepts. I see that every NSView and every class that subclasses it has one thing called frame, and one called bou...

Cocoa custom view for NSMenuItem

Hi folks, I am developing a small app that display the active mounts in a menu in the NSStatusBar. So far it looks like this: I want to add an eject button to the right of each menu item (like the left bar in the Finder). I know that I have to create a custom view and set it with the setView: method. The problem is that I am very new...

Switch between NSView

Hi there. I have an NSView with two views inside of it. I am trying to hide one view and show the other one, but the view won't change. I tried with setHidden, removeFromSuperview, addSubview in front, everything. The first view is still there and the other one will not show itself. I am doing something wrong? Thank you, —Albé ...

Is Cocoa animator proxy unable to handle 0.5 points?

I'm trying to move the origin of a custom view. If I directly set the new origin for the frame, everything is working fine as expected. [MyView setFrameOrigin:NSMakePoint(0.5, 0.5)]; If I try to animate the movement with the proxy animator. [[MyView animator] setFrameOrigin:NSMakePoint(0.5, 0.5)]; The new origin will be (1, 1) inst...

Retrieving CGImage from NSView.

Hi everybody, I am trying to create CGImage from NSTextField. I got some success in this. Still I cant get CGImage that consisting of only text. I mean to say that,every time capturing the textfield I am getting color of the background window along with it.(Looks like I am not getting alpha channel info) I tried following snippet fro...

Detecting proximity of two object in the same NSView

I am working on a drawing program and am trying to figure out the best way to imitate the 'magnet' behavior found in applications such as Omnigraffle. The idea is: as a line is drawn between two objects (visual objects on screen, not OOP objects), as the line from the first object approaches the second, a 'magnet' or 'node' on the seco...

contentsize and contentOffset equivalent in NSScroll view

I am porting an app from Ipad to mac. (I know that it sounds weird) I stuck with NSScrollview. Please guide me contentsize , contentOffset equivalent in NSScrollview. ...

NSView background image composed of 3 different files.

Hi, I'm trying to set a background image of an NSView. (Actually an NSScrollView.) At the moment I'm subclassing drawRect: and I'm using NSDrawThreePartImage to draw the image but there are a few things that are not correct whenever I start scrolling. Here's an image. Are there better ways to draw the images? - (void)drawRect: (NSRect)...

No MouseUp:/Down: on custom view in NSSplitView on Leopard

I am currently working on a project build for OSX 10.5 and up. First of all, the 10.6 users do not see this; only 10.5 users have this issue. You are not able to reproduce this on 10.6. In short: when placing an custom extended class of NSView with an overload implementation of - (void)mouseUp:(NSEvent *)theEvent the mouseUp doesn't get...

Cropped rectangle doesn't work as expected

I have an NSView to draw a rectangle to crop image, and one NSImageView to be webcam (camera preview window). I want to put the NSView on the NSImageView. When I take a picture, it can produce a cropped image automatically. The problem is that when I don't start the camera preview window, the crop rectangle can drag and resize normall...

how to stop NSScrollView from scrolling on resize?

I'm writing a PDFViewer for a 3rd party PDF library. I have a subclass of NSScrollView and a subclass of NSView. The problem is the NSScrollView will scroll up and down when I resize window. here is the relevant code: whenever windows is resized, my subclass of NSScrollView receive this message: -(void)handleFrameChange:(NSNotificatio...

Deselecting NSTableView when clicked somewhere outside the table.

I have a NSTableView placed on top of NSView. I want to deselect the NSTableView when mouse pointer is clicked on NSView. How to achieve this? ...

NSView overlay passes mouse events to underlying subviews?

I have a loading overlay which is supposed to block all the AppKit Controls off untill loading is done. However the view seems to be passing all the mouse events to the underlying layers. How to disable that? ...

CAAnimationGroup with different interface elements

Hi, I want to crossfade two NSViews and resize their NSWindow. I know how to do them separately but so far not how to do it simultaneously. I think I need a CAAnimationGroup for it. But because I'm dealing with two different objects, I don't know how to add the two animations in the group and I don't know how to start the animation beca...

PDFView (PDFKit) not displaying with core animation layers turned on.

I'm doing a sort of kiosk app with a number of buttons that swap out the subviews in a window. There are about a half dozen subviews, all of which are NSViews. One of the subviews has in it a PDFView displaying a local PDF file. Without any core animation, everything works as expected. When I click the button corresponding to the PDF...

NSView Object respond as an IBOutlet

hey, i am stuck on one problem that i am not able to solve. I have a CourtView : NSView in which i can draw and where it stores my mouseDownPoint and mouseUpPoint. And I have a WindowManager : NSObject which has CourtView as an IBOutlet CourtView *courtView; What i want to do is that as soon as the mouse is released, so - (void)mouseU...

Resizing Nested NSViews

In order to categorize a wide variety of unique views, I have an elaborate setup: main categories are selected via a toolbar, and then specific panes are selected in a category's NSScrollView. This looks like: window -> NSViewController controlling five views -> sub-NSViewController for each view controlling X views -> each view contains...

How to efficiently set Cursor for an NSView?

I have an NSView that is drawing a collection of irregularly shaped (and overlapping) application managed objects: that obviously can't be described by efficiently using non overlapping rectangles. I want to change the cursor when it it over one of these objects. The usual method seems to be to set up tracking rects in response to -(vo...

Use Half of QCView

I feel like this should be a simple issue, but I can't figure it out. I have a QCView in my app. When I display it normally, it looks like this: QCView. But, I only want to see the top half of it, because on the bottom half I want to see what is on the NSView under it. When I try to do this, I get this: QCView Half. How can I get it to ...

Hiding/Removing/Fading CALayer erasing NSView contents

My situation: I have a single window with a content view (NSView), which has several subviews (plain NSControl subclasses; not important, just for testing) scattered around it. For part of the end effect I am trying to achieve, I want to place a semi-transparent black CALayer overlaying the whole window's content view, and be able to m...