cocoa

Best resource to learn application programming? (.Net/Cocoa/etc)

I'm an embedded programmer - primarily very small systems where I deal with data as bits, not objects. I'd like to learn how to program for Mac and PC using their native libraries (Cocoa and .Net). I've hacked a few things together in Xcode and Visual Studio, but I feel like I'm hacking, not programming. I put things in AwakeFromNib wit...

Drawing on desktop in Mac OS X

I want to create analog of program conky. What is the best way to draw information on a OS X desktop? ...

How to use "takeStringValueFrom" with Button onclick Event?

I have a button that correctly wired such that when it is clicked, the "login" IBAction is hit. - (IBAction) login: (id)sender { NSLog(@"OK"); } Now, I wired the button to the username/password text fields using "takeStringValueFrom" but I don't understand how to then get at those values? Hope that makes sense. EDIT: so basica...

Cocoa/Objective-C - Can i somehow see the implementation files?

I believe i can learn thing or two if i can see the implementation files (.m files). Is there any way the i can view NSString.m or NSNumber.m files? and others? If i try to find these files using spotlight, i get nothing. ...

Parsing XML from an HTTPS URL using NSXMLParser?

I'm trying to parse XML directly from an HTTPS URL, as follows: NSString *const URL = @"https://some/HTTPS/url"; NSURL* url = [NSURL URLWithString:URL]; NSXMLParser* parser = [[NSXMLParser alloc] initWithContentsOfURL:url]; [parser setDelegate:self]; [parser parse]; I have the following delegate method for the parser: - (void) parser...

Performance tuning in Cocoa application

Hi I am developing a Cocoa application which communicates constantly with a web service to get up-to-date data. This considerably reduces the performance of the application. The calls are made to the web service asynchronously but the number of calls is huge. In what ways can I improve the performance of the application? Is there a goo...

Should I use NSDecimalNumber to deal with money?

As I started coding my first app I used NSNumber for money values without thinking twice. Then I thought that maybe c types were enough to deal with my values. Yet, I was advised in the iPhone SDK forum to use NSDecimalNumber, because of its excellent rounding capabilities. Not being a mathematician by temperament, I thought that the m...

Regular expressions in an Objective-C Cocoa application.

Initial Googling indicates that there's no built-in way to do regular expressions in an Objective-C Cocoa application. So four questions: Is that really true? Are you kidding me? Ok, then is there a nice open-source library you recommend? What are ways to get close enough without importing a library, perhaps with the NSScanner class? ...

Simple string parsing in Cocoa / Objective-C: parsing a command line into command and arguments.

Here's a piece of code to take a string (either NSString or NSAttributedString) input that represents a command line and parse it into two strings, the command cmd and the arguments args: NSString* cmd = [[input mutableCopy] autorelease]; NSString* args = [[input mutableCopy] autorelease]; NSScanner* scanner = [NSScanner scannerWithStri...

Get the filepath when dragging a file from finder to a webview?

I am developing a flvplayer with cocoa. I want to drag a flv file from the finder and drop it to the webview window (I use it to view the flv). But I didn't have the path of this file from finder. This is my code: _ (void)showflv(nsstring*)aa { .......... //Register to accept flv drag/drop NSString *p...

Updating the progress indicator while downloading firmware to the device.

I am developing a cocoa application which downloads firmware to the device. The progress of downloading is showed using NSProgressIndicator. I call the -incrementBy: method of NSProgressIndicator after DeviceRequestTO method in a while loop. But the progress indicator gets updated only after the entire firmware is written to the device. ...

com.finder.desktopservices asks for admin password when copying files

Hi I am trying to copy files from my mac to a network drive. When copying the files, an empty file is created at the destination and I get a prompt saying I might have to enter an administrator password to change the file named "whatever my file name is". When I press continue, the password dialog shows it is com.apple.desktopservices w...

What type of reference does NSNotificationCenter keep for 'observer's & 'object's?

Can anyone clarify/elucidate the situation with respect to -[NSNotificationCenter addObserver:selector:name:object:]? What types of references are kept by the notification center of the 'observer' and 'object' arguments? What are the best practices for removing observers from the notification center? What are the special concerns for m...

PyObjc vs RubyCocoa for Mac development: Which is more mature?

I've been wanting to have a play with either Ruby or Python while at the same time I've been wanting to do a bit of Cocoa programming. So I thought the best way to achieve both these goals is to develop something using either a Ruby or Python to Objective-C bridge (PyObjc or RubyCocoa). I know that ideally to get the best learning exp...

Using KVC to generate SQL?

Hi, I wonder if it is possible to use KVC to generate SQL. I'm doing a light ORM; I wanna do something like this (pseudocode): for key in object.getKeys sql = sql + formatField(key,objet.value[key]); and get: INSERT INTO Table (Field1) VALUES (1); Is this possible in Objective-C? ...

How do I create NSColor instances that exactly match those in a Photoshop UI mockup?

My UI designer gives me great UI mockups created in Photoshop. I want to exactly match the colors in the mockup, but every time I create a color using the -colorWithCalibratedRed:green:blue:alpha: method of NSColor, the colors do not match. I have tried sampling the colors from the Photoshop mockup using the Pixie app in /Developer/Appl...

What software and hardware are essential for developing for iPod? On a PC?

I have an idea for a simple application to run on an iPod. I'm an experienced programmer but have no experience on iPod or any Mac or Apple operating system. What are the bare essentials in terms of hardware and software to begin developing using a PC as the development platform? Does the PC need to be running Linux? ...

iPhone Memory Debugging

I'm using Instruments to try to determine if there are places in my application that I could be more efficient with use of memory. I've taken the time to get somewhat familiar with Instruments but I'm generally a newbie with hunting memory management issues having come from a Java background. I seem to be using about 1.82mb by calls to t...

Exposure Lock in iSight

I am creating object-detection program on Mac. I want to use iSight in manual exposure mode to improve detection quality. I tried iGlasses & QTKit Capture to do that and it worked but program runs very slowly and unstable. So I want to try other solution. In PhotoBooth.app, iSight seemed to be run in fixed exposure mode so there might ...

Cocoa Touch: What to release, when to release it?

I'm trying hard to understand when and what I must relase in Cocoa Touch as it doesn't have garbage collection. This code block is from apples iphone sample PeriodicElements and they release anElement and rawElementArray but not thePath, firstLetter, existingArray and tempArray? I would have thought that at least tempArray and existing...