cocoa

What is the proper way to access local variables in a delegate?

I'm trying to access an NSMutableArray which is a data member of my AppDelegate class. It is synthesized in the implementation, and is an array of a custom class which has a "name" NSString data member. I currently use it to fill a Table View (a SubView) like this: cell.textLabel.text = [[[delegate contentArray] objectAtIndex:indexPat...

NSManagedObjects that I own being released by main.m?

First, in my root view controllers viewDidLoad, I initialize an NSDictionary with arrays of NSManagedObjects, like so: - (void)viewDidLoad { [super viewDidLoad]; self.title = @"Decks"; UIBarButtonItem *browseButton = [[UIBarButtonItem alloc] initWithTitle:@"Browse" style:UIBarButtonItemStylePlain target:self action:@selecto...

How to composite several NSImages into one big image?

I have a collection of objects which describe an image-name, its size and it's X/Y location. The collection is sorted by "layers", so I can composite the images in a sort of painter's algorithm. From this, I can determine the rectangle necessary to hold all of the images, so now what I want to do is: Create some sort of buffer to hol...

Fixed Height NSTableView, Avoid Scrolling

I have an NSTableView that has a very small fixed number of rows. When I create an NSTableView in Interface Builder, the NSTableView is contained within an NSScrollView. I have not found a way to make the table exist outside the context of a scroll view. Since the table only has a small number of rows, I don't want it to scroll. I wa...

Closing an NSWindow

I have a NSWindow that hosts a WebView that Ive hooked up to a script handler. Now, when the user clicks a button on a control on the WebView it calls a Objective C method on my object. In this specific case, the action of the button is to try and close the window hosting the WebView [[webView window] close]; This usually works, but ...

Getting error gcc-4.2 failed with exit code 255

When I am trying to run a cocoa application on my snow leopard i getting the following error Command /Developer/usr/bin/gcc-4.2 failed with exit code 255 ...

Adding audio channel using ffmpeg

Hi all, I am working on ffmpeg and trying to add a audio stream on the fly. I am using AudioQueues and I get raw audio buffer. I am encoding audio with linear PCM and hence the audio I get will be of raw format, which I know ffmpeg does accept it. But I cannot figure out how. I have looked into AVStream, where in we have to create a new...

how to add member variable and methods to in built class without subclassing it.

hi, How can I add member variables and methods to an in built class(say, NSString) without subclassing it. Regards, lenin ...

how to append ignorable white spaces to corresponding NSXMLElement

Hi, How can one add ignorable white spaces to current accumulation of characters of NSXMLElement object while parsing an XML file using NSXMLParser. Here is the delegate method i am using. - (void)parser:(NSXMLParser *)parser foundIgnorableWhitespace:(NSString *)whitespaceString ...

Get the number of dividers in an NSSplitView

I suspect that the number of dividers in an NSSplitView is equal to [[MySplitViewObject subviews] count] -1 and that the index of any given divider in an NSSplitView is equal to the index of the subview to the left of or above the divider (depending on the NSSplitView's orientation). Is it, or is there some undocumented and exposed prop...

How to use mock and verify methods of OCMock in objective-C ? Is there any good tutorial on OCMock is available on the internet?

My problem is I am getting an error: OCMckObject[NSNumberFormatter]: expected method was not invoked:setAllowsFloats:YES I have written following Code: (void) testReturnStringFromNumber { id mockFormatter = [OCMockObject mockForClass:[NSNumberFormatter class]]; StringNumber *testObject = [[StringNumber alloc] init]; ...

Runtime error about sox library in cocoa application

Hi, I am trying to sox library into my project and installed library using ./configure, make and make install and linked to the libsox.dylib into my project. I am not getting compiler error but getting run time error . Now i am getting following error, [Session started at 2010-03-03 17:33:44 +0530.] dyld: Library not loaded: /usr/l...

Get NSString/NSData object from hardcoded bytes saved as NSString object in webservice response

Hey all, I am working with the iPhone SDK and I have to process a webservice response I receive from an external service. The response data consists of an XML string that was UTF8-encoded to a byte array. This byte array is converted to string This string is put into a XML wrapper element The wrapper is returned via an HTTP response ...

Simulating key press events in Mac OSX

Hi, I'm writing an app where I need to simulate key press events on a mac, given a code that represents each key. It seems I need to use the CGEventCreateKeyboardEvent function to create the event. The problem is that this function needs a mac keycode, and what I have is a code that represents the specific key. So, for example, I reciev...

use core-image in 3d

hello, i have a working Core Video setup (a frame captured from a USB camera via QTKit) and the current frame is rendered as a texture on an arbitary plane in 3d space in a subclassed NSOpenGLView. so far so good but i would like to use some Core Image filter on this frame. i now have the basic code setup and it renders my unprocessed v...

entering fullscreen on subclassed NSOpenGLView leaves empty window

hello, i have an application with 2 windows, one is a custom subclassed NSOpenGLView and one is displaying some standard cocoa user interace. making the opengl view go fullscreen (only on one NSScreen) works by calling enterFullScreenMode and exitFullScreenModeWithOptions and supplying the right screen and setting NSFullScreenModeAllS...

What is the modern way to play sound data in 'snd ' resource format?

Sound Manager functions such as SndPlay() are deprecated and not available in 64-bit. The AudioServices functions are modern but only seem to deal with files and are not documented to handle this format. ...

NSDrawer prevent from resizing

Is there a way to prevent a NSDrawer from being resized? I've tried setting the Min and Max content size to the same value and no luck. ...

Event path in Mozilla plugin on Mac

I'm writing a mozilla plugin on the mac. I'm trying to capture events like button clicks, etc. I've done the normal thing of creating my views in inteface builder, and linking the sentActions to methods in my program. This works in stand-alone programs. However, in my NPAPI plugin, those methods never get called. The button reacts, depr...

How to retain an window without holding a pointer to it in garbage collected Obj-C?

I am currently working through the famous "Cocoa Programming for OSX" by Aaron Hillegaas. In Chapter 12 he wants me to create an about window using [BOOL] successful = [NSBundle loadNibNamed:@"About" owner:self]; which, by itself, works perfectly well. However, I am using the garbage collector and since I do not retain a pointer to t...