cocoa

What is a design of iChat?

iChat does not allow to change your credentials to your account when List window is open and you are connected to server. I am just wondering how this is implemented. I could imagine that internally iChat has some sort of ICAppDelegate that hold a pointer to ICPreferencesControler and an array of ICListWIndows. And now how preferences a...

Audio equivalent of QTMovieView?

Hi, does anyone know of an audio equivalent of QTMovieView. Something that allows playback and scrubbing of audio files. QTMovieView without the movie... ...

Is there a "right" way to have NSTextFieldCell draw vertically centered text?

I have an NSTableView with several text columns. By default, the dataCell for these columns is an instance of Apple's NSTextFieldCell class, which does all kinds of wonderful things, but it draws text aligned with the top of the cell, and I want the text to be vertically centered in the cell. There is an internal flag in NSTextFieldCell...

Force loading/unloading a view

How can I setup a view controller to refresh the fields in the view only it is pushed on a navigation controller and releases the objects when it is popped from navigation controller views. My goal is that for a view controller: Refresh display only when it is pushed on the navigation controller stack releases data when it is popped f...

How to Get the Display Name with the Display ID in Mac OS X?

Hello! I was wondering if you could help me figure out how to progmatically get the Display Name for a monitor by using its Display ID number in Mac OS X (10.5)? A requirement is if I give a function the Display ID, it'll provide the Display Name in return (or vice versa). Display Name looks something like this: "Color LCD", "SAMSU...

Missing chunks when creating file with AudioQueue

So a .wav file has a few standard chunks. In most of the files I work with, the "RIFF" chunk is first, then a "fmt " chunk, then the "DATA" chunk. When recording using AVAudioRecorder, those chunks are created (although an extra "FLLR" is created before the "DATA" chunk.) When creating a file with AudioQueue, those standard chunks aren'...

How do I break down an NSTimeInterval into year, months, days, hours, minutes and seconds on iPhone?

I have a time interval that spans years and I want all the time components from year down to seconds. My first thought is to integer divide the time interval by seconds in a year, subtract that from a running total of seconds, divide that by seconds in a month, subtract that from the running total and so on. That just seems convoluted ...

Create DMG file

I am developing an application in Cocoa. I need to create a DMG file to install my application like Adium (which provides a nice UI to drag the app file to Application folder). Is there a tool for this? ...

Description of initWithNibName, awakeFromNib and viewDidLoad?

Is there a good overview of initWithNibName, awakeFromNib and viewDidLoad that lays out the best way to use each of these and describes exactly what each does? I find these very confusing. In the template that's generated with a View Controller, the comment about initWithNibName says: "The designated initializer. Override to perform se...

Categories for NSMutableString and NSString causing binding confusion?

Hi, I have extended both NSString and NSMutableString with some convenience methods using categories. These added methods have the same name, but have different implementations. For e.g., I have implemented the ruby "strip" function that removes space characters at the endpoints for both but for NSString it returns a new string, and fo...

What exactly does rangeOfCharacterFromSet do?

NSString *foo = @" x "; NSRange r = [foo rangeOfCharacterFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSLog(@"foo range = %d,%d",r.location, r.length); Results in "foo range = 0,1" So will it ever return a length > 1? ...

When does selectedCell change?

I have an NSTableView and I want to do something whenever the selectedCell element changes. So, my table view is called tableView, and this is what I want to observe: [tableView selectedCell] I tried using key-value observing, but that didn't seem to work, or maybe I was doing it wrong. Any ideas? ...

Converting between C enum and XML

What's the cleanest way to store an enum in XML and read it back out again? Say I've got: enum ETObjectType {ETNormalObjectType, ETRareObjectType, ETEssentialObjectType}; ...and I want to take a variable, enum ETObjectType objectType = ETNormalObjectType;, and convert it to XML that looks like this: <objectType>ETNormalObjectType</obj...

Problems with IBOutlet getting nil.

I have an instance of a class "A" in my EAGLView class, it gets instantiated in the EAGLView's initWithCoder method. This class "A" contains an IBOutlet to a UIView. I also have an instance of this class "A" in the Interface Builder, to connect the class "A" IBOutlet to the corresponding view. So the class "A" is being instanciated t...

How to serialize a Property List Storing NSNull

I want to store in a NSMutableDictionary some null values using NSNull and then serialize this data using a property list. Problem is NSNull is not allowed and I get "Property list is in invalid format" error. Is there a workaround for this? Seems very surprising they didnt put NSNull on the list of valid plist objects. Thanks, D ...

Nested arrays in Objective-C ( NSMutableArray )

Hi, I'm trying to build a nested array: First, I make a "PlayerItems" array which will contain 10 arrays, each containing item objects, corresponding to the inventories of each player in the game. On the indicated line, I get the following error: error: void valued not ignored as it ought to be What is the void value here? If I use...

How I can set a date string from twitter to a NSDATE

The date you get back from twitter is in this format Fri Aug 07 12:40:04 +0000 2009. I am able to assign the value to a NSDate without issue. However, when I attempt to use NSDateFormatter, I get a nil returned to me. What am I missing? NSDate *createdAt = [messageData objectForKey:@"created_at"]; NSDateFormatter *format = [[NSDateFor...

find natural block size of the media being used by file handle

Hi Guys I want to find out the natural block size of the IO media being used in an cocoa application. I saw a function in IOMedia.cpp called "getPreferredBlockSize()" which supposedly gives me my block size. Please can you guys explain me how to use this function in my app or if there is any other method using which i can find the natura...

Can I hook up an action within an NSCollection view via Interface Builder?

I have an NSCollection view. I want to connect a control in the replicated view either to an outlet my controller, passing in the representedObject, or to an outlet on the representedObject itself. Can I do this with IB or do I need to do this programmatically? ...

How to Extract AppleScript Data from a NSAppleEventDescriptor in Cocoa and Parse it

Hello! What I'm doing is executing an AppleScript inside of Cocoa. It returns some data as a NSAppleEventDescriptor, which NSLog() prints like so: <NSAppleEventDescriptor: 'obj '{ 'form':'name', 'want':'dskp', 'seld':'utxt'("69671872"), 'from':'null'() }> I want to take that data and turn it into a NSDictionary or NSArray, or someth...