cocoa

Does NSThread have a separate heap? What about pthread (on iPhone)

If I detach an NSThread will Cocoa run it in a separate memory heap or memory zone? For example, if I were to detach a thread, use malloc to create a large buffer, and then let the thread exit, would I get that memory back in some kind of automatic thread cleanup, or would it be leaked? What about if I used a POSIX thread (pthread) inst...

How to define the WebPluginMIMETypesFilename in the plist of a safari webplugin project?

I want to know the defination of WebPluginMIMETypesFilename, if my project is SafariPlugins. target extension is webplugin, My WebPluginMIMETypesFilename is com.SafariPlugIns.webplugin.plist? and what is the webPluginMIMETYpes, I just know when safari lunch , it will test the webplugin if have the webPluginMIMETYpes or not. and then load...

NSLog with CGPoint data

I have a CGPoint called point that is being assigned a touch: UITouch *touch = [touches anyObject]; CGPoint point = [touch locationInView:self]; I want to get the x coordinate value into my console log: NSLog(@"x: %s", point.x); When I use this, log output for this is: x: (null) I have verified that point is not null when this i...

Cocoa counterpart to Windows' SetTimer

Is there any equivalent function on OS X to SetTimer in Windows? I'm using C++. So I'm writing a plugin for some software, and I need to have a funtion called periodically. On Windows I just pass the address of the function to SetTimer() and it will be called at a given interval. Is there an easy way to do this on OS X? It should be as ...

Accessing raw image data with Snow Leopard

I develop with XCode 3.2 under Snow Leopard, and I want to read a jpg-file from disk into memory and manipulate directly with the raw image bitmap presented as a C char array. How can I achieve this? ...

Receiving keyDown and keyUp events in a Cocoa Status Bar app

If you create a status bar app with no windows, how do you respond to events? My first guess was creating an subclass of NSResponder and override the appropriate methods. However they never get called. This lead explicitly calling: [self becomeFirstResponder]; Which also didn't work (and I don't believe is recommended by the Apple D...

Adding to a core data model from an NSArray.

I have an NSArray of strings and I want to add a certain amount of rows to the outline view depending on how many strings are in the array, each with the title of the String that was added. I think it would involve looping through the array like this. for(NSString *title in array) { JGManagedObject *theParent = [NSEntityD...

What are the ways to convert/encode to AAC in Cocoa?

Is there a way to programmatically convert and/or encode to AAC/m4a format in Cocoa without the use of any libraries or programs that don't ship with Mac OS X? I don't want to use for example, faac or ffmpeg, to do the encoding. ...

How to base class behaviors on typedef enums, the way Apple does in Objective-C?

Kind of a weird newbie question...I want to use typedef enum declarations in one of my classes . This particular class gets used by other classes, where a client class might say something like "set your style to Style1 (enumerated type)". Then the target class's behavior would change accordingly. This is analogous to the way that UITa...

How to bind a TextField to an IBOutlet()?

I'm trying to figure out how to update an NSTextField programatically. I've figured out how to get the current value of the Text Field from Python: myVar = objc.IBOutlet() .... self.myVar.stringValue() How do I set the value of myVar from the Python side and have the GUI update? I'd like some sort of two way binding (like {myVAR} in...

NSTextField on top of custom drawing - black outline and cursor not blinking?

Hey All, I'm completely stumped with this problem. I made a custom search control that uses a few different classes. For some reason, when an NSTextField is anywhere over these different pieces, it displays a solid black border around it, and the cursor doesn't blink. If anyone has a couple minutes - I've put together my code on pasteb...

setOpaque:YES vs setBackgroundColor:[NSColor clearColor]

I'm going through a tutorial on drawing a custom [shaped] window with cocoa by subclassing NSWindow. The tutorial states that in initializer developer should do the following: [self setOpaque:NO]; [self setBackgroundColor:[NSColor clearColor]]; So i'm wondering what is the differnce between these two messages and why are they needed ...

drawRect not being called on added subview

I'm trying to programmatically create a window with custom contentView and one custom NSTextField control, but i'm having trouble getting this hierarchy of window and views to draw themselves. I create a custom borderless window and override it's setContentView / contentView accessors. This seems to work fine and custom contentView's in...

NSRunningApplication - Terminate

How would I use NSRunningApplication? I have something opposite of that which is launching an app: [[NSWorkspace sharedWorkspace] launchApplication:appName]; but I want to close one. I get an error when I debug the code for NSRunningApp which is this: NSRunningApplication *selectedApp = appName; [selectedApp terminate]; Is there so...

Vending an Object with Distributed Objects and Synchronizing access

I'm using Distributed Objects in my application to provide communication between a tiny authentication agent program and the main application. The main application spawns NSTask's, which in turn will invoke the authentication program, which in turn will call back to the main program to get some user credentials. I know it sounds convol...

Retaining an authorization object

Right now I have my application executing some things using AuthorizationExecuteWithPrivileges. The problem is that it needs to ask for the password for every operation. Is there any way I could have it authenticate as soon as the app starts so that it won't ask for authorization later, and then release the authorization object when its ...

Using scrollViewDidScroll with multiple UIScrollViews

I have two horizontally scrolling UIScrollViews stacked vertically on top of each other within one ViewController. Each UIScrollView takes up half the screen. I am trying to independently track the position of both UIScrollViews. I have successfully used this to track the position of the top UIScrollView: - (void)scrollViewDidScroll...

Tool for viewing structural xib differences?

Is there a diff tool for viewing differences in XIB's? It could display what graphical elements are in one xib while missing in other? ...

Making a NSPopUpButton display all my iCal Calandars.

I have a NSPopUpButton and I want the Menu Items in it to display the users iCal calenders. From there I want it depending on which is selected to change this code. CalCalendar *calendar = [[store calendars] objectAtIndex:0]; The code defines which iCal calender to sync to, at the moment it's the default calender, however I want to ch...

Making a Method happen every 60 seconds when the App is running.

I'm wanting to make one of my methods to run every 60 seconds when my App is running, how would I do that? ...