cocoa

Cocoa: detect unmountable volume

I folks, I am developing a small app which should be able to unmount volumes. Currently, I am using the following code to determine whether a volume is unmountable or not: BOOL isRemovable, isWritable, isUnmountable; NSString *description, *type; BOOL succ = [ws getFileSystemInfoForPath:[itemInfo objectForKey:@"path"] ...

NSPanel transform using NSAffineTransform

This is a rather simple question and I'm sure it's not to hard, but the question is... I have a NSpanel that is centered and then after the centering I need to do a transform to move the window down on the Y coordinate while maintaining the centered X coordinate. Is NSAffineTransform the correct way to go about this and does anyone hav...

Vectors in Cocoa Touch / Objective-C

Hi all, Is it possible to use vectors in Coca Touch? If so, what library must be included? I was following a general C tutorial on them an the only thing needed was to #include <vector> But XCode states that there is no such file or directory. Any pointer to a library that provides such functionality is appreciated. Regards ~dhp ...

Is returning nil from a [[class alloc] init] considered good practice?

And is it a common idiom in Objective-C. I've only seen this used on [[NSImage alloc] initWithContentsOfFile: str] and it always make me think there is a memory leak, because i called alloc and the mantra is: "Call alloc and call you must call release" - unless its one of the cases where you don't need too. ...

Creating a Method that Accepts a String Format Cocoa

How do you create a method in Objective-C that accepts a NSString format (using the comma seperated list list of arguments to substitute into the format). Something like: // Hello Kevin NSString *name = @"Kevin"; [NSString stringWithFormat:@"Hello %@", name]; ...

Comparing of 'Class' with other 'Class' in Objective-C

Does a comparable function to 'isKindOfClass:' exist for comparing a 'Class' to another (i.e. without constructing an instance of either class). For example, given: Class class = NSClassFromString(@"NSNumber"); [NSNumber isKindOfClass:class]; // YES [NSString isKindOfClass:class]; // NO Thanks! ...

NSPanel set at the Desktopwindowlevel +1 issue with visible at login

This is a rather annoying issue, The program itself works great except when I go and set it to start at login. I've been testing it by logging off and in. The program starts when I log in but is hidden behind the desktop. When I click the app icon in the dockbar it comes to the front where it should have been to begin with. The quest...

NSWindow blocking the application like an Alert Panel

Hi everyone, is it possible to get an NSWindow to block everything in my application just like an Alert panel so that it is the key window until closed? ...

NSMutableArray getting overwritten on every pass within a loop

greetings Cocoa masters - this simple issue has me crawling the walls. I have a custom class called Movie which consists of a bunch of properties and a few collections. I am populating it successfully using FMDB and SQLite. However, with each pass through the result collection from the DB, my addObject: seems to be writing over the entir...

Using an nsimage as a "green screen"

Hi, Is it possible for me to take use an image as a green screen type thing like in photo booth where it takes the background out? ...

Having context menu for NSButton created dynamically

I am creating NSButton dynamically in the cocoa application which is fine. However once the application launches, I want to perform right click on the NSButton created or would like to have context menu for the NSBUtton. How to achieve this? ...

Session Maintenance for Login Page

Hi friends, My Requirement: I want to send login details(email, password) to server, have to maintain session for valid username. How to create & maintain a session using "NSURLConnection" of iphone SDK? If you found any Tutorials/Code snippets on this issue,Please post the corresponding linke here. Advance thanks for your help. ...

NSString - replacing characters from NSCharacterSet

Hi Everyone, I gotta little question about string Programming: I have an NSCharacterSet which contains all the characters I want to remove from my NSString. How can I do that? Thank you, Christian ...

How to change default help unavailable message

Hi all, When help viewer is not integrated within cocoa application it gives this message: Help isn't available for XYZ Is there any way to change this default message? Thanks, Miraaj ...

Configuring log4Cocoa

Hello. Im trying to configure the log4cocoa framework to log as DEBUG level messages to the console and INFO level to some file.I cant figure out how it's done. I have not found any documentation about it, what make things even harder. This is an example of configuration I`ve tried (not working): log4cocoa.rootLogger=DEBUG,A1 log4coc...

NSTextField cursor position

I'm trying to get the cursor position inside a NSTextField but so far unsuccessfully. Tried using [[myWindow fieldEditor:FALSE forObject:myTextField] selectedRange].location but no luck. Any ideas? ...

Retaining an NSWindow size and state - looking for an elegant way to do this

I have a controller class which spawns a window when a certain condition occurs. This window can be closed by the user, moved around or resized. Ideally, when this condition occurs, I'd like the window to re-open in the same spot the user closed it last time. Looking for an elegant way to do this. Pointers (or references) will be most...

IB: Where is the Bindings Pane

Hello, Cocoa newbie here... I know this sounds stupid but I can't find the Bindings Pane in Interface Builder. I have the latest xCode( 3.2.3 ) but tried with other versions too, still the same. The Tools menu does not list it and Cmd-4 opens up the Identity inspector. Screenshot What could be the cause? Thanks ...

Doing [obj release] on obj with retainCount=1 does not decrement retainCount to zero

Hi, I created a simple program to test the retain/release methods in Objective-C memory management. As I understand of ObjC memory management, I expect that a object with retain count = 1 on which I call release get the retain count decremented to zero and then released. But this test program show that after the first release I still ge...

NSClassFromString Case Insensitive Objective-C

I am attempting to instantiate classes from different XML sources. The cases of the class names are inconsistent (camel, upper, lower) across these sources. Does an equivalent to NSClassFromString exist for this? For example, something allowing for: Person *person = [[NSClassFromCaseInsensitiveString("Person") alloc] init]; Person *pers...