cocoa

Should I verify objects inside Foundation API containers?

In languages like C++ and C# when you create a contain such as a std::vector or a C# list you explicitly declare the container type when you create it: C++: std::vector<MyObject> C#: List<MyObject> list = new List<MyObject>(); Looking at the code above, I know immediately that these containers can only contain objects of type MyOb...

NSImage and related APIs leaking memory

Hi Following is the code snippet that I have: // Make Auto release pool NSAutoreleasePool * autoReleasePool = [[NSAutoreleasePool alloc] init]; try { if (mCapture) { // Get the image reference NSImage* image = NULL; image = [mCapture getCurrentFrameImage]; // Get the TIFF data NSData *pDataTifData = [[NSData all...

multiple results of enter in an NSWindow

I have a multi-line textField in a window. I need the user to be able to hit return in the textfield for its normal purpose. I have a normal text field, that if the user hits return, I want it to just accept the text I also have an OKButton, that, if you're not in a textfield, i want return to do the OK button. Currently, wherever I a...

Reading String from File with Objective C

This one is weird. Hopefully I will ask the right question: I'm using an md5 method to create a checksum value which I then write to a file. Then afterwards I read the file using this: NSString * id_From_File = [[NSString alloc] initWithContentsOfFile:path_to_ID encodi...

send the user input to the xe.com and just fetch the result to display it in the program in objective c

hi all i want to use just the result of any online currency converter as a variable in to my program. double amount_d; amount_d=[amount doubleValue]; NSString *mar=[NSString stringWithFormat:@"http://www.xe.com/ucc/convert.cgi? Amount=%d&From=%@&To=%@",amount_d,code1,code2 ]; [[NSWorkspace sharedWorkspace] openURL:[NSURL URLW...

How do you specify to display a diamond in a NSMenuItem (minimized window indicator)?

I'm creating a JNI to display an application wide menu bar instead of the JFrame specific one. This allows me to keep a menubar displayed even when no JFrames are present. I've hit a small snag, in my window menu I can't figure out how to display a diamond for the windows that are minimized. As far as I can tell in the standard API there...

cocoa: know the position of the app icon in the dock

Hello, I need to show a special menu when the dock icon is hovered. In order to do this I need to find a way to get the coordinate of the app icon in the dock. Do you know how I can get this info? Thanks and regards, ...

imagebrowser reloadData behaves weird

There's a delegate object for my imagebrowser imageDelegate and I try to reload all data from outside of it by calling: [imageDelegate reload]; in it, I add images to an array and call [imageBrowser reloadData] I am sure images are added to array but the imagebrowser keeps being blank. (I set animates to it already) But when I ca...

Translate Apple's model identifiers (MacBookPro5,1) to user-friendly names?

Does Mac OS X have API that translates Apple's model identifiers (the kind found in plists and APIs, e.g., "MacBookPro5,1") to user-friendly marketing names of these devices ("Unibody MacBook Pro Late 2008")? I'm looking for more future-proof solution than simply hardcoding a list. ...

Entity is not key value coding-compliant for the key - Objective-C/CocoaTouch/CoreData

if (win) { // Game was won, set completed in puzzle and time // Calculate seconds taken int timeTaken = (int)([NSDate timeIntervalSinceReferenceDate] - self.gameStartTime); int bestTime = [[self.puzzle valueForKey:@"bestTime"] intValue]; if (timeTaken < bestTime && bestTime != 0) { [self.puzzle setValue:[N...

What is clipRect in NSTableView?

Hello, I am trying to understand the meaning of clipRect in a table view embedded inside a scroll view. I assumed that the clip rect is the visible portion of the table view. This means that the width of the rect should not change as long as the table view is not resized, but upon monitoring the width of the clip rect in the following c...

Getting Notifications of isDocumentEdited

Hello, is it possible to bind/get notifications of the isDocumentEdited property of NSDocument without calling the will/didChangeValueForKey: methods on every change? ...

How to get the width of an NSString?

I am trying to get the width of an NSString (ex. NSString *myString = @"hello"). Is there a way to do this? Thanks. ...

CARenderer never produces output

Hi, I've been stuck for hours trying to render a Core Animation layer tree into an OpenGL context using CARenderer. The OpenGL context is currently provided by a NSOpenGLView subclass set up in Interface Builder, with settings on default. Here's how I set up the CALayers in my example: l1 = [[CALayer layer] retain]; // l1 is an...

how can i use webview object in cocoa to display webpage?

i want to display the web page in my program ,i use the WebView object in my IB (.xib) but it dosent work ,is there any sampel code ,not doc or article? view_w.h @interface view_w : NSObject { IBOutlet WebView* Web; } -(IBAction) google:(id) sender; @end view_w.m -(IBAction) google:(id) sender { NS...

WIll QT have any future as a GUI toolkit on MacOSX?

Today i tried to implement the owner drawn menu item support in Cocoa and MacOSX 10.5 And what i found was pretty scary when i think about QT which i intended to use for some other projects. If i see it right there is no future for QT on MacOSX because the whole Appearance Manager with the exeception of a few trivial functions is compl...

NSKeyedUnarchiver does not call initWithCoder

Hello All, I've used the following example: http://stackoverflow.com/questions/2670815/game-state-singleton-cocos2d-initwithencoder-always-returns-null Instead of using a file, I use an NSData object i am getting from NSUserDefaults. It is not null, but rather have data in it that I believe is the correctly encoded data and for some ...

Interface Builder Bug?

I have a cocoa program that I have I am writing on a 10.6 system, but targeting to 10.5. On the 10.6 system, it works fine. However, when I run it on the 10.5 machine, I get: The sender of menu item actions is now the NSMenuItem, not an NSMatrix. A menu item action method appears to be trying to send the NSMatrix method 'acc...

how do I catch a NSRangeException?

I want my app to continue gracefully when the online server messes up. I tried to wrap the dangerous line in a @try block. Yet it is still crashing like so: the method: + (NSArray *)findAllFor:(NSObject *)ratable { NSString *ratingsPath = [NSString stringWithFormat:@"%@%@/%@/%@%@", [self getRemoteSite], [ratable getRemo...

NSString's isEqualToString: seems to erroneously report non-equality

I'm trying to compare the equality of two multi-line strings. I'm getting one of the strings from a web service, and the other I'm getting from iTunes via the Scripting Bridge. The strings from the web service are eventually transferred to iTunes, so if I do that and then re-compare the strings, ideally they'd be identical. However, w...