cocoa

making graphs with xCode

Hi I need to graph some arrays to analyse signals, I have a cocoa project going. Can anyone tell me where I can find tools to simplify this task? Basically i want to display my arrays like on a graphing calculator. ...

Putting an NSPopUpButton in an NSToolbar

Having wrestled with NSPopUpButton in a previous question here I am now trying to place a NSPopUpButton inside an NSToolbar. Essentially I want to create something similar to what XCode has by default on the left hand side of it's toolbar. E.g. a pop up button with an action button next to it. I have seen a method that show's a programm...

How do I take a screengrab of a single window using Cocoa or Carbon on OS X?

I need to be able to identify a single window on the user's screen and take a screen capture of it. The screen data is to be stored in memory and not written to disk. This is already supported through the commandline tool /usr/sbin/screencapture or through the Grab utility (though their functionality is not extensive enough to justify ...

Switch Between Views in Cocoa (not Cocoa Touch)

It seems like there is a lot of online information regarding switching between views in Cocoa Touch, but not that many in "desktop" Cocoa. For an app I am creating, I am wondering the pros/cons of the methods (and please list the methods if you could), and which one people personally use/suggest. I don't think that using an invisible b...

Easy way to archive interlinked objects

In a game I have a bunch of objects and collections of objects, some of them include references to others. Is there a straightforward way to archive them - to save a game state - while maintaining those references? If I understood well, NSArchiver can do that, but it wasn't available on SDK 2, is it on SDK 3? (I have sort of asked this ...

How to count lines? : Objective-C

I want to count the lines in an NSString in Objective-C. NSInteger lineNum = 0; NSString *string = @"abcde\nfghijk\nlmnopq\nrstu"; NSInteger length = [string length]; NSRange range = NSMakeRange(0, length); while (range.location < length) { range = [string lineRangeForRange:NSMakeRange(range.location, 0)]; range.lo...

Why do these errors in Xcode Mean?

2009-07-06 06:49:13.666 Spark[9825:10b] -[<NSUserDefaultsController 0x137af0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key hotKeyDisplayEntry. 2009-07-06 06:49:13.667 Spark[9825:10b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSUserDefaultsController 0x137...

How to position the horizontal and vertical scrollers of scrollview embedding imageview??

[[self enclosingScrollView] setHorizontalLineScroll:0]; the above api doesnt works. Help Appreciated... ...

Finding YUV file format in Cocoa

I got a raw YUV file format all I know at this point is that the clip has a resolution of 176x144. the Y pla is 176x144=25344 bytes, and the UV plan is half of that. Now, I did some readings about YUV, and there are different formats corresponding to different ways how the Y & US planes are stored. Now, how can perform some sort of ch...

Can I make this code work with Shortcut Recorder?

I have this code(below) to create a customizable Hot Key. OSStatus MyHotKeyHandler(EventHandlerCallRef nextHandler,EventRef theEvent,void *userData) { EventHotKeyID hkCom; GetEventParameter(theEvent,kEventParamDirectObject,typeEventHotKeyID,NULL,sizeof(hkCom),NULL,&hkCom); HotKeyController *controller = (HotKeyController *)u...

Who is responsible for releasing objects in an array when copying?

In Objective-C, if array1 is copied onto array2 using mutableCopy, and suppose the code is done in main(), who is responsible for releasing the objects contained in the array? Is it main() or array2? ...

Global object for Javascript to interact with Safari plug-in

The issue is that I've written a Safari plug-in (http://tr.im/growler) that allows web applications to send Growl notifications by calling Javascript functions. However, at the moment the way it is written, people need to use <embed> to initialise the plug-in so that Javascript can begin using it (something I picked up from Apple's examp...

Calling system("open <app name.app>") sometimes causes app to be launched as root

I've got an application (A daemon inside /Library/StartupItems to be precise) running as root that occasionally launches another process using system("open /Applications/MyAppName.app"). This works fine except that on certain computers MyAppName gets launched running as root, instead of under the current user. I'm trying to figure out w...

Parsing XML in Cocoa

Hi Everyone: Today I am looking into how to make a simple XML parser in Cocoa (for the desktop). I am thinking of using NSXMLParser to parse the data, but am not quite sure where to start. The XML file on the web doesn't have the much data in it, just a simple listing with a few things that I need to save into a variable. Does anyone...

Convert NSValue to NSDecimalNumber

I've got a plist (created in XCode) with an array full of "Numbers" (0.01, 1, 2, 6) that unpacks into NSValues when reconstituted with initWithContentsOfFile. How can I turn these NSValues into NSDecimalNumbers that I can use for adding together? They will be treated as currency values so only need precision of 2 (maybe 4) decimal place...

/usr/bin/codesign failed with exit code 1

Hi Everyone: I am attempting to deploy my first development iPhone app, and am running into some problems. I have successfully went though the online Provisioning Assistant, but now I am stuck. No matter what I do, I always get the following error. /usr/bin/codesign failed with exit code 1 Anyone have any ideas why this is happening...

Date increment

I want to take the next day by giving the current date The code i used as follows +(NSDate *)getForDays:(int)days fromDate:(NSDate *) date { NSTimeInterval secondsPerDay = 24 * 60 * 60 * days; return [date addTimeInterval:secondsPerDay]; } this works fine but when the daylight saving enabled this leads to errors. How can ...

Objective C - Using insertString for an NSMutable string

With a NSMutableString, how would I insert a "-" sign at the index "0" for an NSMutableString called "a". Right now my code looks like this: a = [insertString: @"-" atIndex: 0]; Xcode throws an error saying that 'insertString' is undeclared. Something looks very wrong with my code. Please give me guidance. ...

Objective C - Using deleteCharactersInRange for NSMutableStrings

How would I use deleteCharactersInRange to remove the first character of a NSMutableString? ...

Objective C - What is the value of a UITextField with nothing in it

I want to refer to the value of an empty text field because I want make an if function that if there is nothing in the UITextField the text of the UITextField will become "nothing". ...