cocoa

How would one implement a sidebar similar to Mail/iTunes/Finder/etc in Cocoa/IB?

I think the title pretty much says it all... I'm looking to implement an interface similar to the standard OS X sidebar used in all the above mentioned programs, and I'm wondering if anybody has any thoughts as to the easiest way to do it, namely about what view to use for the left hand selection pane. Really I don't think I even need th...

Parsing an NSXMLElement in Cocoa

Hey all, I'm trying to use XPath to parse an XML document. One of my NSXMLElement's looks like the following, hypothetically speaking: <foo bar="yummy"> I'm trying to get the value for the attribute bar, however any interpretation of code I use, gives me back bar="woo", which means I need to do further string processing in order to o...

Self-owned objects in Objective-C Garbage Collection

I'm wondering what are the recommended ways to handle situations where, in memory managed code, object didn't belong to any particular owner, i.e. objects released themselves. One such example could be a subclass of NSWindowController, which configures, displays and manages input and output of a single window. The controller object displ...

How can I use custom animations for onOrderOut in Core Animation?

Core Animation allows for custom animations by implementing the actionForKey method in your CALayer based class: - (id<CAAction>)actionForKey:(NSString *)key { // Custom animations return [super actionForKey:key]; } I can then create an animation and return it for the onOrderIn action (i.e. when the layer is added to another layer)....

Getting started with Mac development

How long does it take for an experienced Windows programmer to learn writing simple software for Mac OS X? Where does one start and what tools will be necessary? ...

Stop text from wrapping with NSLayoutManager

Given any arbitrary, one-line string, my goal is to render it into a bitmap representation. However, I have no means of finding out its dimensions beforehand, so I am reduced to getting the glyph range's bounding rect and resizing my canvas if it's not large enough. Unfortunately, if the canvas is not wide enough for the string, but ta...

NSApplication and -applicationDidFinishLaunching:

Hi All, I have an application where I have a main.m that returns NSApplicationMain(argc, (const char **) argv);. I want to run code on -applicationDidFinishLaunching:, but I just dont see how to do it. Can anyone help or have an example? Thanks! -Jason ...

-[NSOperationQueue operations] returns an empty array when it shouldn't?

I'm writing an application that does async loading of images onto the screen. I have it set up to be NOT concurrent (that is, it spawns a thread and executes them one at a time), so I've only overridden the [NSOperation main] function in my NSOperation subclass. Anyway, so when I add all of these operations, I want to be able later to ...

NSThread with _NSAutoreleaseNoPool error

I have an method which save files to the internet, it works but just slow. Then I'd like to make the user interface more smooth, so I create an NSThread to handle the slow task. I am seeing a list of errors like: _NSAutoreleaseNoPool(): Object 0x18a140 of class NSCFString autoreleased with no pool in place - just leaking Without NST...

Create a cross platform Windows, Mac OS X application

Hello, I would like to build an application that runs on both Windows and Mac OS X. I would also like it to leverage the best of what the platform it runs on has to offer with regards to Frameworks, API's etc. Is there a way to do this without having to write Objective-C code and then C# code? I've been thinking of C++ as an alternative ...

Printing without Page Setup - reacting to paper size and orientation changes?

The AppKit release notes for Leopard say: In many applications it is not appropriate to present page setup panels to the user, or even include a Page Setup... item in the File menu, but there has been no other easy way to let the user specify page setup parameters to be used when printing. (New UI advice: if your applic...

Layer Backed Views and Flickering Controls

I have a window which contains an NSBox control. In that NSBox are several other controls, (popups, text fields, etc...) I have two other NSBox's in the same NIB file that are filled with controls that I would like to swap out with the first under certain conditions. I would like this to happen with a nice cross fade effect, so I do the...

Dealing with objects returned from cocoa convenience methods

I'm having a lot of issues with NSDate objects being prematurely deallocated. I suspect that the issues may be related to the way that I deal with the objects returned from NSDate convenience methods. I think that my showDate property declaration in the JKShow class should be "retain", but changing it to assign or copy seems to have no e...

NSString indexOf in Objective-C

Are there anything similar to an indexOf function in the NSString objects? ...

Need to do old fashioned input/output in Cocoa.

I am new to Cocoa and need to capture input using scanf to run a program that requires input of four variables one at a time. Is there any console, window class, canvas, memo class (as in delphi) that will llow me to do this. Earl Cenac ...

NSString tokenize in Objective-C

What is the best way to tokenize/split a NSString in Objective-C? ...

Escape sequences in STAssertEqualStrings

I'm writing a discovery test against the Cocoa API as I ramp up on all things Mac related. I'm currently trying to discover the best method for URL encoding a string. Using the Google toolbox for Mac I have a unit test that I intentionally cause a failure in: NSString* expected = @"ab%%20c"; NSString* encoded = @"ab c"; STAssertEqual...

Create NSString by repeating another string a given number of times

This should be easy, but I'm having a hard time finding the easiest solution. I need an NSString that is equal to another string concatenated with itself a given number of times. For a better explanation, consider the following python example: >> original = "abc" "abc" >> times = 2 2 >> result = original * times "abcabc" Any hints? ...

NSDateFormatter won't parse dates using locale settings?

I'm trying to parse dates using the user's date preferences [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4]; NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateStyle:NSDateFormatterShortStyle]; NSDate *date = [ dateFormatter dateFromString:@"7/4/2008" ]; NSLog(@...

Getting an NSImage from an NSProgressIndicator

I need to put the image from an NSProgressIndicator into an NSOutlineView Cell. I have written up code that does this for a determinate indicator and it works just great: NSProgressIndicator *progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0, 0, 16, 16)]; [progressIndicator setStyle:NSProgressIndicatorSpinningS...