cocoa

NSXML replacing "<" with "%lt;"

I see there are other questions related to this, but none using NSXML. So, I'm constructing an XML document from scratch using NSXML and when I create a NSXMLNode with a string value, all the "<" characters in that string are replaced with "& lt;" when I output the node, or save it to a file. Example: NSXMLNode *description = [NSXMLN...

Make a table row's text editable immediately

I have an NSTableView in my user interface, where new rows are added when the user presses a button or keyboard shortcut. Each row consists of two text cells (the table is comprised of two columns). Is there a way to immediately select the first text cell of a new row which is added? So, basically, I would like the user to be able to pr...

Printing arguments sent to forwardInvocation: subclass of NSProxy

I want to intercept messages sent to a proxy object by just printing the selector and arguments. Even if the proxy does not implement them and does not have a target object. Please help. I have looked at several options and Apple docs but they assume that you already know the target object. I want to do this cleanly without memory issues...

How do you change which view is active in a window?

The program I'm working on right now is a bit cumbersome, as it starts with a central menu, and then once the user chooses an option from it it opens their selection in a new window, when I've got a perfectly good window I can (at least apparently) repurpose to that effect. I've been reading the manual regarding views, and I understand ...

Closing old window when opening a new one in Cocoa

Ok, I have two windows, A and B. When I click a button on Window A, I want it to close and take the user to Window B. makeKeyAndOrderFront does a great job of activating Window B, but how do you get it to then close Window A? ...

How to obtain codesigned application certificate info

Hi folks, I am having a tough time finding an answer to my codesigning issues. We have an application for Mac OS written under Cocoa. Finally - we did our codesigning, but i would like to add an extra security check - within the executable itself. My idea is to validate the fingerprint of the certificate with which the current executa...

How do I share a Core Data store between processes using NSDistributedNotifications?

Background I've already posted a question about the basics of sharing a Core Data store between processes. I'm trying to implement the recommendations given and I'm running into problems. My Goal I have two processes - the Helper App and the UI. They both share a single data store. I want the UI to update it's NSManagedObjectContext ...

How can i convert NSBezierPath to CGPath

How can i convert between NSBezierPath to CGPath. Thanks. ...

How to obtain an unformatted string representation of an NSDecimal or NSDecimalNumber?

I have an NSDecimal and need this as technical string, i.e. with no formatting in any way. Floating point should be a "." if there is any, and minus sign should just be a "-" if there is any. besides that, there should be no formatting going on like grouping or chinese numbers. I was looking for 2 hours through the SDK but it seems ther...

Help needed on font for localized string

Hi, My client has given me a custom TTF font only for English. So my intention is to load that TTF only for English and for other languages it should fallback to the available System font. I am doing the following steps: Registering fonts with my app. Copying into Resources folder and add to my project. Loading the font with name. N...

Changing an NSImage in XCode - this line of code not working

I am having a problem that is eating me alive. I really hope I am just missing something small here. It appears to be a rather "n00b" issue. I have a blank NSImageView that I want to display a picture when a button is pressed — simple as that. Here is my line of coding NSBundle *mb = [NSBundle mainBundle]; NSString *fp = [mb pathForRe...

Effective 15x10 array computation

Hey guys! Now I have one trouble for develope one iPhone app. I need to compute 150 parts and draw it on canvas. I have code like this: for (int i=x1; i<=x2; i++) { for (int j=y1; j<=y2; j++) { x=[NSNumber numberWithInt:i]; y=[NSNumber numberWithInt:j]; BoxCach...

A comparison between the cocoa and .net frameworks

the purpose of this question is to make it easier for developers trying to migrate between the two. If you want to learn one technology, you'll want to know how its different from those that you know. What should someone know when switching between the Cocoa and .NET frameworks? Related: .Net guy needs some info on Cocoa ...

What is a good service that offers registration code and activation services for Cocoa/OSX applications?

I have a completed Cocoa application and would like to sell it. I have found many services that will sell your application, but not many that will also handle activation. Are there any services that will integrate activation into the installation file or are there any services that are easy to integrate (hopefully will take at max an hou...

Clicking the mouse down to drag objects on Mac

I've been using the following code to issue clicks programmatically on a Mac void PostMouseEvent(CGMouseButton button, CGEventType type, const CGPoint point) { CGEventRef theEvent = CGEventCreateMouseEvent(NULL, type, point, button); CGEventSetType(theEvent, type); CGEventPost(kCGHIDEventTap, theEvent); CFRelease(theEve...

Ignoring user input while waiting for a task - Objective-C

I have an app with a button 'convert'. When I click this button, the app starts a new process using NSTask and then greys out the button until the process finishes. My problem is, the app saves any clicks made by the user while it is waiting for the process to finish. So even though the button is grayed out, the user can click it and th...

Sending data to PHP scripts in the background from Cocoa

I have information I'm planning to sync between an iPhone application and a desktop application via a PHP script; is there a method of calling the script in the background to send data to the online database and then retrieve the data from the script? ...

Objective-C creating a text file with a string.

I'm trying to create a text file with the contents of a string to my desktop. I'm not sure if I'm doing it right, I don't get errors but it doesn't work either... NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES); NSString *desktopDirectory=[paths objectAtIndex:0]; NSString *filename = [desk...

Releasing @property(copy) instance variables?

I am pretty sure I am doing this right, but just wanted to check. I have two instance variables that have accessors created via @property. In my dealloc (for the same object) I am releasing these objects. @property(copy) NSString *firName; @property(copy) NSString *surName; -(void)dealloc { NSLog(@"_deal: %@", self); [firName r...

Cocoa move to parent from a subclassed instance

I have a subclassed NSTextField to limit the maximum length (only 1 character). Now, once the user finishes entering this one character I would like to move the focus to the next NSSTextView. This is where I need some help. How can I tell the application "move the focus to the next field"? I suppose I need to call the parent view from th...