cocoa

How to get a swf name of a DOMElement object?

Now I have detect a swf url and DOMElement object in a webpage , but I still want to know the swf name , I think that the name is not regular using url, and the name will using the DOMElement , but How to get the name of it ? Just like this method : - (id)sb_initWithFrame:(NSRect)frame pluginPackage:(id)pack URL:(id)url baseURL:(id)ba...

I'm developing GUI apps on Mac. I have been using C++ for 10+ years. Do I need to switch to Objective C?

I've been coding on C++/Linux for 10+ years. I am switching to do Mac development. My development involves GUI components. Is my only choice to learn Cocoa/Objective-C, or is there a way to wrap Cocoa and use it from C++ land? Thanks! ...

How expensive is it to retrieve a model object from an nsarraycontroller?

I've a window with a table. The table lists several model objects by name. Those model objects back a window and that window's components all depend on the model objects for their values. Some tables on that window cannot be bound to the model object and must be populated using a data source. In this situation I retrieve the currently s...

Is a path in the Url Loading System of Cocoa always an URL, or sometimes an URI?

I don't get it: An URL is something that really "locates" a ressource, i.e. it holds enough information to say "man, go here, then there, and you have it!" ...while an URI can say "the file is called foobar.foo ... have fun finding it!" Or am I wrong? Can the URL loading system handle URI's? How would that look in example? For me it doe...

How do I check if a NSView is being displayed at the moment?

I got an application which has a NSToolbar in its main window. Depending on which icon is clicked a NSView is displayed in this window. My problem is, that one of these views shows data in a NSTableView that I want to be reloaded each time the view is visible. Since -init is only called once, I don't know how to do that. (example: When t...

Making skype like token field for adding users to a chat

Hi all, In Mac, in skype when we add users to an existing chat, by clicking '+' button on top, a beak like window appears carrying a token field like control. When an user types some name in it and a match is found then a list appears carrying user icon , status icon and his/her name. Also the width of dynamic list is same as beak windo...

Which schemes does NSURL / NSURLRequest / NSURLConnection understand?

Apple says, NSURL is developed using RFC 1738 (and some others). Now RFC 1738 specifies only that an web URL has a scheme and a scheme specific part. I want to know all the schemes which NSURL understands. And because I use it with NSURLRequest and NSURLConnection (the so called "URL Loader System"), I must know all the schemes which ...

Cocoa: int main function

I'm curious, what role does the int main function play in a Cocoa program? Virtually all of the sample code I've been looking at has only the following code in main.m: #import <Cocoa/Cocoa.h> int main(int argc, char *argv[]) { return NSApplicationMain(argc, (const char **) argv); } What exactly is this doing, and where does t...

Is there a reason why I shouldn't just define #define NSFM [NSFileManager defaultManager] instead of writing it out each time?

There is a built-in shortcut NSApp, is there any reason that I shouldn't add one for NSFileManager? #define NSFM [NSFileManager defaultManager] I think omitted this will make my code cleaner and I can't see any benefit to keeping it in. (I plan on doing this in all my projects from now on, so it won't be obscure.) NSFileManager *fm =...

interface builder setters? please punch me!

if you have an IBOutlet on an ivar like IBOutlet UIView *view; @property (nonatomic, retain) UIView *view; that object created by ib will be managed by ib, but what if you have, UIView *view; @property (nonatomic, retain) IBOutlet UIView *view; does ib now use your setter to set that object? that would mean the setter has added +...

Cocoa: Calling a method from AppDelegate.m

In order to better understand the startup, event queue, and methods within my application I'm trying to write a program that does two things: Play a beep at the startup and every time the user hits a button. So far it only plays when the user hits the button. I know there may be multiple ways to get the startup beep to play, but in ord...

Setting the front most window using accessibility API

I want to set a certain window, from an external app (for example textedit), to be front most. I can successfully get a reference to the app itself using GetFrontProcess, and check whether it is front most. If it is not, I can use setFrontProcess to make it focussed. I can then use the the accessibility API to examine all the windows u...

NSNotification the right choice for detecting changes?

I have a custom subclass of UIView that needs to perform a selector when a value (NSInteger) falls below a certain value. From what I can tell from the docs, I need to set up an observer object to look for this change. The NSInteger value exists in the view controller and the UIView subclass is implemented as a subview in the same view...

Object life after death (retain count = 0)

I just noticed this in some code that's been working for months. Though it makes me curious I'm sure we've been living on borrowed time... Assuming activeItem: @property (nonatomic, retain) ItemView *activeItem; And we have this conditional in touchesEnded: if (CGRectContainsPoint(dropRect, touchLocation)) { ItemView *replacemen...

Translating clicked NSPoint in NSImageView to correct pixel coordinates in the underlying NSBitmapImageRep

Here is what I'm trying to accomplish: I'm working on an open source TI calculator emulator where I'm currently trying to add skin support. The skin image is just an NSImageView with its image set to the skin image. I override the mouseDown: method and get the location of the mouse in the NSImageView coordinates using convertPointFromBas...

Searching a string from a specified start point in objective c

I am interested in searching a string (using objective-c) starting from a specific character in the middle of the string. I could split the string, but is there another way? I don't see an obvious option for that in the definition of NSString. I want to be able to search either backwards or forwards in the string starting from a define...

How to use NSWindowController?

I'm looking in to using NSWindowController and I just can't think how to get it working. How do I start using it? ...

os version checking in cocoa

Hi all, I am developing an application in cocoa which needs to check whether the current version is snow OS or not .If current version is snow then i need to close the application with an error alert.Please let me know how to find the current os version. Thanks in advance ...

scanUpToCharactersFromSet stops after one loop

I'm trying to get the contents of a CSV file into an array. When I've done this before I had one record per line, and used the newline character with scanUpToCharactersFromSet:intoString:, passing newlineCharacterSet as the character set: while ([lineScanner scanUpToCharactersFromSet:[NSCharacterSet newlineCharacterSet] ...

version checking before application launch cocoa

Hi, I am developing an application in cocoa which is not compatible with snow os .Is it possible to show an alert message while user try to launch the application in snow os? ...