cocoa

How do you programmatically put folder icons on the Finder sidebar, given that you have to use a custom icon for the folder?

Am currently working on a project, and though I can add sidebar items by adding to the com.apple.sidebarlists.plist file then restarting Finder, I can't seem to know how to make the folder icons show up using its assigned custom icon. Can anyone point me to a link or a solution that would make me do this? Thanks a bunch in advance! ...

Use NSArrayController with nested NSMutableArrays (Cocoa Bindings Question)

Hi, I have a NSArrayController with following Object: @interface AdressCard : NSObject <NSCoding> { NSString* name; NSString* street; NSMutableArray* tasks; } I have a simple GUI with an NSTableView to display the first two keys and I want to have a second NSTableView to display the content of the MutableArray (tasks) for...

File Watcher in Cocoa

Hai all, I am developing an application in cocoa.I want to constantly check whether the contents of a file in a particular location is changed or not (like FileSystemWatcher in .NET).Please anyone give me a solution.I used FSEvent but it monitors only folder for changes...But I need to know whether a file in that folder is changed or not...

Find the Last Modified Date of a File in Cocoa

How can I find the last modified date of a file in cocoa? ...

Is there a way to specify argument position/index in NSString stringWithFormat?

C# has syntax that allows you to specify the argument index in a string format specifier, e.g.: string message = string.Format("Hello, {0}. You are {1} years old. How does it feel to be {1}?", name, age); You can use arguments more than once and also omit arguments that are provided from being used. Another question mentions the same ...

Problem with releasing an object

I've got this code: Entry.h #import <Foundation/Foundation.h> @interface Entry : NSObject { id object; SEL function; } @property (retain) id object; @property (assign) SEL function; -(Entry*) initWithObject:(id)object selector:(SEL)function; @end Entry.m #import "Entry.h" @implementation Entry @synthesize object; @synt...

What do these errors in the XCode Debugger Mean?

I have 2 errors in XCode and am trying to figure out what they mean. The 1st one: 2009-06-30 18:56:27.998 Spark[4584:10b] Error setting value for key path filterPredicate of object <NSArrayController: 0x1482c0>[entity: group, number of selected objects: 1] (from bound object <NSSearchField: 0x143f20> with object ID 1387 in Nib named...

NSImage rotation

I have a window with an subclass of NSView in it. Inside the view, I put an NSImage. I want to be able to rotate the image by 90 degrees, keeping the (new) upper left corner of the image in the upper left corner of the view. Of course, I will have to rotate the image, and then translate it to put the origin back into place. In Carbo...

Is it possible to replace the Mac login screen?

Is it possible to replace the Mac OS X login window, /System/Library/CoreServices/loginwindow.app, with a custom login window application? (See my rational for doing so.) I'm afraid my Cocoa programming skills are rudimentary. I do find it interesting that, when I run probe CGSession (which is a undocumented utility that performs fast...

Unfamiliar C syntax in Objective-C context

I am coming to Objective-C from C# without any intermediate knowledge of C. (Yes, yes, I will need to learn C at some point and I fully intend to.) In Apple's Certificate, Key, and Trust Services Programming Guide, there is the following code: static const UInt8 publicKeyIdentifier[] = "com.apple.sample.publickey\0"; static const UInt8 ...

Cocoa: Quartz, Core Graphics, Context vs View. Oh My!

Heads starting to hurt. I think I dropped into this too fast... Perhaps someone could help me visualize how these (excluding OpenGL ES) high level drawing libraries fit together - or point me to some high level docs. For example I see "context" and "view" used interchangeably in some cases but a view has one (only one?) context while a c...

Using NSThreads in Cocoa?

I wanted to know how to use threads in Cocoa. I'm new to this so I don't understand the documentation that well. The Top half of the code is for timing and the bottom half is for the date. Can anyone show me how to use a single thread and how to use 2 threads to handle both operations. NSDateFormatter *timeFormatter = [[[NSDateFormatte...

What is the most efficient way to sort an NSSet?

What's the most efficient way to sort objects in an NSSet/NSMutableSet based on a property of the objects in the set? Right now the way I am doing it is by iterating through each object, add them to a NSMutableArray, and sort that array with NSSortDescriptor. ...

How to draw a default image in imageview in the center of imageView?

How to draw a default image in imageview in the center of imageView?using - (void)drawRect:(NSRect)rect overridden method of NSImageView ...

Open source Objective-C projects with high quality code?

I think one of the best ways to learn a new programming language is to dive into source code and see how experienced coders write. I've found this kind of question asked here on Stack Overflow for other languages, but none targeted at Objective-C. The closest I've found is this question about good-looking Cocoa user interfaces, but I'm...

Alert the user when exceeding 25 characters in a text view

I'm new to Objective-C. I have created a textview in code, that limits its text to 25 characters. When the user wants to add more than 25 characters in the textview it shows an alert view... Now the problem is, when I click the done button it again shows the alert view. Can anyone tell me how to solve this? ...

Dynamically loading a part of a Window in Cocoa

I have an area of a Window (in my MainMenu.xib) which I'd like to populate dynamically with unrelated "views" such as an NSTable, IKImageBrowserView etc. at different points of time depending on some user-selected criteria. How do I define this area of the window such that it can be "replaced" with different views? How do I attach a ta...

- (void) keyDown: (NSEvent *) event does not work..

Below is the sample code. - (void) keyDown: (NSEvent *) event { NSString *chars = [event characters]; unichar character = [chars characterAtIndex: 0]; if (character == 27) { NSLog (@"ESCAPE!"); } } Should I need to set any delegate in InterfaceBuilder or any kinda binding?? Help Appreciated... ...

Two images intersection transparency

There are two images. image1 and image2. I have added image2 on image1. Overall the output image must be image1 only but, the portion of the image2 must become transparent. I mean the alpha values on the intersection area must be in reverse order( i.e, if alpha value of one pixel( say 120, 100) on image2 is 1.0 then the same pixel's alph...

How do I get the current date in Cocoa

I'm getting started developing for the iPhone and as such I am looking at different tutorials online as well as trying some different things out myself. Currently, I'm trying to create a countdown until midnight. To get the number of hour, minutes, and seconds, I do the following (which I found somewhere): NSDate* now = [NSDate date]; ...