cocoa

Suggestions on how to organize Core Data visual layout?

Core Data is pretty amazing, and I've really enjoyed using the visual layout Xcode provides for it to organize things and get a quick sample of what data I've placed where. At times I've started to wonder if I'm making the best use of it, however, as after a while there tends to be such a mass of arrows that it becomes difficult to tell...

NSSavePanel: Squelching the "confirm replace?" dialog

In the Nav Services world one could specify kNavDontConfirmReplacement as an option to create a NavDialogRef that would not ask the user to confirm the replacement of a file when saving with a file name that already exists. How do I specify an equivalent behavior with the Cocoa NSSavePanel? ...

Drawing text in a NSButton subclass

How would I add the text from the title of the button in my NSButton subclass? ...

What tool or technology does Apple use to create its documentation?

I am sure they use something really fancy to create their documentations and guides. Everything is so streamlined and equal, and they always have a HTML and a PDF version. Now we make a big framework and want to provide a good documentation that's set up the way Apple does it. Online in HTML format and offline in PDF. Any idea how the A...

Encoding issue: Cocoa Error 261?

So I'm fetching a JSON string from a php script in my iPhone app using: NSURL *baseURL = [NSURL URLWithString:@"test.php"]; NSError *encodeError = [[NSError alloc] init]; NSString *jsonString = [NSString stringWithContentsOfURL:baseURL encoding:NSUTF8StringEncoding error:&encodeError]; NSLog(@"Error: %@", [encodeError localizedDescripti...

Cocoa HUD window - how to turn off topmost?

I've wrote some small cocoa app and it's main window has HUD style. The problem is - when I set HUD style Interface Builder automatically also sets Utility style - which make the main window topmost (always visible over every other windows). Is there a way to get HUD style panel/window but without making it topmost? ...

conditional implementations of methods.

ok.. think of objectA.. objectA has optional properties defined in its protocol. the delegate may or may not implement these, but if you do decide to implement them, you must provide a valid return. now what if i have objectA.delegate set to objectB but object be needs to implement them all at compile time, and at runtime will decide wh...

Changing a NSWindow view in code

I would like to have a detail view come in to focus when the user double clicks on a table view row. How would I change a window's view in code? ...

Fading in one view for another

Here's my code: - (IBAction)showTaskDetailView:(id)sender { [window setContentView:viewTaskView]; } How would I fade out the current view and fade in the detail view? ...

NSRuleEditor: Criteria for new row

When I hit the "+" button on a row in NSRuleEditor, a new row is created. How can I take influence on the criteria used for that row. It seems NSRuleEditor defaults to selecting the first criterion sequentially from the list of possible values. I would much rather have the new row match the row where the "+" was clicked. ...

Objective-C 2.0 properties: Why both retain and readonly?

I've noticed that some of Apple's examples include both a retain and readonly modifier on properties. What's the point of including retain if no setter gets generated when we're using the readonly modifier? Example: @property (retain, readonly) NSString *title; from the AnimatedTableView sample. ...

Multiple Xib files - Same Class

Hey there, I'm fairly new at this, but I think what I'm looking to do makes sense. I have a xib that is displayed in portrait and one that is displayed in landscape. Both views are similar, but have a few differences. Some of the buttons, labels and textfields are the same. I can reveal one and hide the other when the orientation is...

iPhone color picker

Hi, I'm trying to build a color picker view on the iPhone. I want to draw one of those 'color maps' and let the user tap on the color. I can create a gradient (in the X axis) ok which gives me the color range, but I also want to combine the lightness (in the Y axis) which is where I'm struggling. Any help would be most welcome. Thanks...

Table view not updating according to bindings - Part Deux

Title borrowed from this question, of which this one is not a duplicate. See my answer there for what was wrong for that questioner; I'm the author of that answer, and my problem is not that one. I have a table view with three columns, whose Value bindings are bound to three properties of the arrangedObjects of an array controller. The ...

Non-modal windows memory management

Hi, I'm a newbie in Mac Dev. I come from iPhone dev. My question relates to non-modal windows management. It's quite different from the iPhone and it's memory management model. Say for example, i have a preference window, i can use something like that to show the window: -(IBAction)showPreferenceController:(id)sender { if (!preferenc...

Getting the number of rows in an NSOutlineView.

How would I get the total number of rows in an NSOutlineView? ...

NSKeyedArchiver internal format

Hello I need to load NSKeyedArchiver classes to C++/CLI counterparts. Is there any way to get internal format of NSKeyedArchiver? Another option is to rewrite whole saving and opening code into pure C++ for both Mac and Windows. Thanks a lot. ...

Drawing text in a NSButton subclass - positioning

I Have a custom button: And I need the text to be centered, here's my code: NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [style setLineBreakMode:NSLineBreakByWordWrapping]; [style setAlignment:NSLeftTextAlignment]; att = [[NSDictionary alloc] initWithObjectsAndKeys: style, NSPara...

Deleting a selected NSTableView row from Core Data?

How would I delete selected NSTableView row and it's corresponding Core Data entry? ...

Creating a NSColor with RGB value

How do I create a NSColor from a RGB value? ...