How difficult would it be to use core animation to make an NSView slide in an out of view like a sheet? Generally speaking, what would be involved in accomplishing this? I've been reading through the CA documentation, but it's been hard for me to pinpoint which parts are relevant to what I want to do since I have no experience with the f...
I have created a subclass of NSView to draw an image as a pattern:
@interface CePatternView : NSView
{
NSImage* image;
id observableObjectForImage;
NSString* keyPathForImage;
}
@end
I implemented the following to expose bindings:
+ (void)initialize
{
// Expose the "image" binding to IB.
[self exposeBinding:@"i...
I'm trying to figure out how to create a view that, depending on the circumstances, has a variable number of items being displayed in it. Something like the grid view in Finder or iTunes, an image with a sort of caption text underneath it. I've heard that you can use an NSCollectionView for this sort of thing, but I don't really know. I'...
Can anyone provide a sample / link to a sample Cocoa app that changes the 'hardware' cursor in a fullscreen OpenGL Cocoa app? I have been able to create a full screen GL app and an app that changes the cursor by overriding NSView::resetCursorRects but I have not been able to get both to work simultaneously. I've also refitted some of t...
Here's a common practice I see often (including from a very popular iPhone developer book)
In the .h file:
@interface SomeViewController : UIViewController
{
UIImageView *imgView;
}
Somewhere in the .m file:
imgView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen]
applicationFrame]];
[imgView setImage:[UIImage imageName...
Greetings all,
I have a puzzling problem. I have a pointer to a vanilla NSView that was initialized in a nib. I message the nsview with
[myNSView setFrame:NSMakeRect(0,0,816,1056)];
but when I step through the debugger, myNSView has a frame of {{0,0}, {801, 1041}}. The dimensions of the rectangle are 15 less than I've specified! Thi...
What I'm actually trying to do is put a WebKitView into a ScreenSaver (which inherits NSView). I'm totally new to MacOS X and Cocoa (but I'm very familiar with Objective-C and used some parts of GNUStep). Do I need some laying out? I want to show only one control in the whole NSView.
...
I’m learning Cocoa programming, and I’m unable to figure out how to
archive and unarchive a custom NSView subclass
I’ve made a toy application that presents a window. This window
contains an instance of my custom BackgroundView class (archived in
the xib file). Clicking anywhere in this BackgroundView creates and
displays a blue square ...
Greetings all,
I hope you all can shed some light on how NSView autoresizes it's views. I've set everything up in IB and my subviews resize nicely (when I resize my window around with a mouse). However, if I do [myMainView setFrame:] with my new frame rect, nothing happens. All of my sub-views are still the original size (even though t...
I have a gameboard with 25 tiles of NSView subclass myGameTile.
In mouseDown: I want to figure out what tile I clicked on and set an ivar to that value.
i.e. If I clicked on tile 12, set myTile to 12. My problem is figuring out in mouseDown: whether it belongs to instance 12 or instance 25. What ways are there to do this?
...
The short version:
Why are the subviews of NSView objects not sent a release message when a Cocoa application terminates?
Is there a way to override this behaviour?
An example:
The MyView class shown below is nothing more than an NSView subclass that reports to the console when it is created and destroyed. I have tested it out and ...
I have an area of a Window (in my MainMenu.xib) which I'd like to populate dynamically with unrelated "views" such as an NSTable, IKImageBrowserView etc. at different points of time depending on some user-selected criteria.
How do I define this area of the window such that it can be "replaced" with different views?
How do I attach a ta...
I have a subclass of NSView, and in that I'm drawing an NSImage. I'm unsing NSAffineTransforms to rotate, translate and scale the image.
Most of it works fine. However, sometimes, the transforms just don't seem to get activated.
For example, when I resize the window, the rotate transform doesn't happen.
When I zoom in on the image, ...
I occasionally want to change an NSView's dimensions programmaticaly. To do this, it is helpful to get the dimensions of various views, adjust them relative to each other, and then use setFrame: to reposition.
The problem is that the frame method usually returns NSRects that are clearly wrong, from my perspective.
I have a program wit...
I need to get CGContextRef of NSView object. It won't be so bad if I knew how.
In Carbon this thing was done like this:
CGContextRef cgref = (libvlc_drawable_t)GetWindowPort(HIViewGetWindow((OpaqueControlRef*)hiViewRef));
Obviously it can be done by subclassing NSView (or it's subclass) and catching it in it's drawRect, but that's to...
What I want to do
I have a circular custom NSView subclass, and I want to change the appearance of the cursor when the mouse is hovering over the circular portions of the view, but not when over the portions of the view's rectangle that fall outside the circle.
Here's an illustration. I would have inlined it with an image tag, but I'm ...
I have an NSView in a ScrollView and I'm trying to draw an image in it. The problem is that I want the upper left corner of the image locked to the upper left corner of the frame, instead of the lower left corner, which is what the View wants me to do. I will need to be able to zoom in and out, and rotate.
currently, I have a kludge of ...
Currently writing a roguelike to learn more about Objective-C/Cocoa. I'm really enjoying it so far and I've learned tons.
This code moves the origin of the view's bounds, so that it follows the player as he moves. The code works perfect, I was just asking if there was a better way than using four for's.
I've also seen in some cases th...
Is it wise to create views in Cocoa that have dimensions around 15000 pixels? (of course only small part of this view will be visible at a time in a NSScrollView)
Interface Builder has limit of 10000 pixels in size. Is this an artificial limitation or is there a good reason behind it?
Should I just create huge view and let NSScrollView...
I am writing a custom NSView subclass. I have several instances of this class in my window, most of which are rotated by calling NSView's setFrameRotation method. I also need to change the cursor when over a rectangular region of this view.
The documentation for NSView's addCursorRect method contains the following oblique warning:
C...