cocoa

NSTextField or NSTextView?

Could someone explain to me what are the main differences between NSTextField and NSTextView? I know that NSTextView has more features and is usually used for longer texts, and NSTextField is usually used for one-line plain text fields, but if I understand correctly, NSTextField can be also used with attributed strings and with multiple ...

Overriding NSDocument's fileWrapperOfType causes "Document could not be saved."

I've got to be missing something simple, but Google is not helping. My file saves and loads fine. (I've overridden dataOfType to get some stuff in it.) Then I override fileWrapperOfType (in preparation for creating a bundle), and I get a "The document 'Untitled' could not be saved as 'test'." sheet when I try to save. Even when I empty ...

Call method with parameters after animation completion

I want to call a method with certain parameters once an animation is done. The flow is something like this: -(void) myMethod:(int)val { [self performAnimation]; [self doSomethingElse:val]; // This should be done after animation completion } I presume the 'doSomethingElse' method needs to be called from the method defined in '...

Saving a "project"-type document (containing sub-documents)

I'm trying to create a "project"-like document, in that it contains subdocuments in a specified directory. I'd like a brand new save of a document to set up that directory with appropriate subdirectories. I'd like a "Save As" to copy all those subdirectories and any files within them to the new location. But I'd like a "Save" to only upd...

writing CDATA block to NSXMLDocument file

Hi, How can one write CDATA block in XML file and save it to a file in cocoa. ...

Why does my NSDateFormatter return nil when parsing?

my code is like this NSString *tempDate = [NSString stringWithString:tempReviewData.pubDate]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateStyle:NSDateFormatterLongStyle]; [dateFormatter setTimeStyle:NSDateFormatterNoStyle]; [dateFormatter setDateFormat:@"HH:mm a"]; NSDate *newDate = [dateForm...

Problem with NSUserDefaults and deallocated Instance

Hi, I'm having a problem with NSUserDefaults. I've followed the steps in the books as closely as I can for my app, but still get the same problem. I am getting a *** -[NSUserDefaults integerForKey:]: message sent to deallocated instance 0x3b375a0 error when I try and load in the settings. Here is the code that I have, it is in the...

Check the Node kind in an XML Tree

I have constructed an XML tree from an XML file. While constructing I do initWithKnd: or initWithKind: options: method. How can I check if a node is of Element or CDATA or ay other kind while tracing the XML tree. ...

Difference between 2 NSDates, excluding Weekends?

For those familiar with Excel, I'm trying to use a similiar NETWORKDAYS function within Cocoa. Can anyone help with the type of info I'll need to construct an NSDate catagory that can give me only the working days betweek two dates? many thanks Nik ...

check the Node kind in an XML Tree COCOA

Possible Duplicate: Check the Node kind in an XML Tree I have created an XML Tree from an XMl file, where each node is initialized with method initWithKind: or initWithKind: Option:. How can I check the kind of node, while tracing the entire tree structure. ...

What's wrong with this method?

I'm getting a warning: "Return makes pointer from integer without a cast" for this method... +(BOOL *)getBoolFromString:(NSString *)boolStr { if(boolStr == @"true" || boolStr == @"1"){ return YES; } return NO; } ...

Cocoa equivalent of the Carbon method getPtrSize

I need to translate the a carbon method into cocoa into and I am having trouble finding any documentation about what the carbon method getPtrSize really does. From the code I am translating it seems that it returns the byte representation of an image but that doesn't really match up with the name. Could someone give me a good explanati...

Show NSSegmentedControl menu when segment clicked, despite having set action

My question is based on another question. Instead of repeating a bunch of stuff, I hope it's okay that I refer you to that other question instead: http://stackoverflow.com/questions/1203698/show-nssegmentedcontrol-menu-when-segment-clicked-despite-having-set-action/ My question is: How would the code within [self showGearMenu] look lik...

objective c id *

I am using the KVO validations in my cocoa app. I have a method - (BOOL)validateName:(id *)ioValue error:(NSError **)outError My controls can now have their bindings validate. How do I invoke that method with a id * NOT id To use the value that is passed in (a pointer to a string pointer) I call this: NSString * newName = (NSString ...

How can I sort by a transformable attribute in an NSFetchedResultsController?

I'm using NSValueTransformers to encrypt attributes (strings, dates, etc.) in my Core Data model, but I'm pretty sure it's interfering with the sorting in my NSFetchedResultsController. Does anyone know if there's a way to get around this? I suppose it depends on how the sort is performed; if it's always only performed directly on the d...

QTMovie pauses on minimize?

I'm trying to create a video player that plays in the dock when minimized. I'm grabbing the current frame from the QTMovie and intermittently setting it as the minimized icon, but when the window minimizes, the movie (or associated QTMovieView) pauses. How can I prevent this behavior? ...

UIEvent has timestamp. How can I generate an equivalent value on my own?

According to the cocoa documentation, timestamp on UIEvent is "the number of seconds since system startup." It's an NSTimeInterval. I'd like to generate, as efficiently as possible, an equivalent number. Of course, I want to do this where UIEvent don't shine. :-) ...

iphone - using NSInvocation: constant value

I am dealing with an old iPhone OS 2.x project and I want to keep compatibility, while designing for 3.x. I am using NSInvocation, is a code like this NSInvocation* invoc = [NSInvocation invocationWithMethodSignature: [cell methodSignatureForSelector: @selector(initWithStyle:reuseIdentifier:)]...

NSTableView won't begin dragging rows if the mouseDown happens within the rect of an NSButtonCell.

I currently have an odd case where I need to be able to reorder rows in an NSTableView, but the only column happens to be an NSButtonCell. I'm trying to see how I can override NSButtonCell's mouse tracking in order to get it to behave in a way so that the NSTableView will begin dragging the row, but am not having much luck. Additional i...

Override System Preference Pane?

Is there a way to override / disable a system preference pane? I'm wanting to put an application together that would disable or override the Energy Saver preference pane, and would put it's own rules in place for putting a machine into standby, turning off the monitor, or other various energy saving activities. ...