cocoa

OS X - App doesn't show up in force quit. How do I fix that?

I'm writing a Cocoa application that installs itself as an menulet in the menu bar (i.e. like the volume or battery icons). When the program crashes, it isn't possible to use the Force-Quit dialog, because it doesn't show up in the list. Of course, I can still kill it using the command-line, but my users don't know how to do that. Is ...

What is the @package compiler directive for in Cocoa?

I see @package a lot in Apple's header files, but for the life of me, I can't find an authoritative source that describes its meaning. ...

taglib.framework for cocoa

Hi, Where can i get the latest taglib.framework which i need to be used in cocoa. Thanks in advance ...

Line Drawing Effect

I want to draw line on UIImageView. I already draw line on UIImageView but when i want to remove these line 7 redraw new lines That can not happen. -(void) drawLine { lastPoint = currentPoint; lastPoint.y -= 40; //drawImage is a UIImageView declared at header UIGraphicsBeginImageContext(drawImage.frame.size); [dr...

Calculating columns with Core Data like SQL

Hey, I am sorting stores to get the closest stores. Furthermore I want to know how far away this shop is. The SQL query would look like this: select *, 6371 * 2 * ATAN2(SQRT(POWER(SIN((RADIANS(?) - RADIANS(latitude))/2),2) + COS(RADIANS(latitude)) * COS(RADIANS(?)) * POWER(SIN((RADIANS(?) - RADIANS(longitude))/2),2)), SQRT(1-POWER(SIN...

How does one add perspective to a UIImageView

I have a UIimageView and I need to give some perspective to the image. Maybe by modifying the vertex of the image... How can I do that? ...

Writing to files in bundle?

If you scroll down to the section 'Writing to Files and URLs' at this link, would the path varaible have to be a file on disk? Is it possible to write to a file in the bundle or must it always be deployed first? ...

NSFormCell for content other than text

I am building a dynamic form in a Cocoa application and am planning to use the NSForm object to add entries to it from an array. Some of the entries require a text input, but some require a boolean input (i.e. a dropdown list), and some even require a file input (i.e. a place to upload an image or a movie or sound file). It seems that ...

Graphical interface buttons in Cocoa

Sitution: Newbie with interface for a music app. I have 2 large images, one the master 'up' or normal view, the other the complete 'down' view. (Buttons all pressed, lit, etc, LED's on, etc). Might have a couple smaller images as well to copy over. In Carbon, and old Mac OS, I would load up 2 GWorlds with each image, then use Copybits t...

Arguments in @selector

Is there any way that I can pass arguments in selector? example: I have this method - (void)myMethod:(NSString*)value1 setValue2:(NSString*)value2{ } and I need to call this function through a selector passing two arguments. [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(/*my method*/) userInfo:nil repe...

List of libraries available on a stock installation of OS X?

I'm trying to compile a version of convert (one of the ImageMagick tools) for distribution with a Cocoa app I'm writing, and I've mistakenly bundled a version that relies on shared libraries my users don't have (twice, already). Thus, I'm trying to pare down the list. After stripping out everything I didn't need, running otool -L conve...

Guess encoding when creating an NSString from NSData

When reading an NSString from a file I can use initWithContentsOfFile:usedEncoding:error: and it will guess the encoding of the file. When I create it from an NSData though my only option is initWithData:encoding: where I have to explicitly pass the encoding. How can I reliably guess the encoding when I work with NSData instead of files...

IBOutlet in Python

Hi all! Is there a way to use a Cocoa IBOutlet in Python? Or do I need to do this in ObjC? Thanks in advance. ...

How to kill a Thread with Objective C?

Hi there, I have a call to a third-party C++ library which I have put into its own thread (currently using NSThread). I would like to give the user the ability to stop the execution of that thread. (I am well aware of all the problems this might cause, but I still wish to do so.) According to Apple's Thread Programming Guide, there ar...

How to escape double quotes in string?

I'd like double quotes to appear within the following string so it looks like: "hi there == " Here's the code I'm using: NSMutableString *s = [[NSMutableString alloc] init]; [s appendString:@""""]; [s appendString:@"hi there == ""\n\r"]; Instead I only get: hi there == Any ideas? ...

NSString to NSDate

I got a string that contains the current date by using this : NSString *date = [[NSDate date] description]; At a different point I am want to retrieve the date from this string and I use the following code [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4]; NSDateFormatter *dateFormatter = [[NSDateFormatter...

Error while checking if a file exists

Hi, I'm trying to write to a plist file using writeToFile, before I write I check whether the file exists. This is the code: #import "WindowController.h" @implementation WindowController @synthesize contacts; NSString *filePath; NSFileManager *fileManager; - (IBAction)addContactAction:(id)sender { NSDictionary *dict =[NSDicti...

Problems with NSTask in OS X 10.6 Snow Leopard

Has anyone else seen or heard of any issues with NSTask in 10.6? This code worked fine yesterday, and is not working today. NSTask *task = [converter task]; [task waitUntilExit]; NSLog(@"Task did complete"); The task does what it's supposed to do (I checked the output and it's fine), but the program will wait indefinitely at the wait...

Loading Nib and Displaying Window in Objective C++

I am trying to load a Nib from a C++ constructor with Objective C++. I have searched and found enough examples to get some code together but it doesn't display the window. Or any windows for that matter. Here is an example of the contructor: JokeSystem::JokeSystem() : fileSystem("/Library/Application Support/Jokes/") { try { ...

How to do sparse array in Cocoa

I have an undetermined size for a dataset based on unique integer keys. I would like to use an NSMutableArray for fast lookup since all my keys are integer based. I want to do this. NSMutableArray* data = [NSMutableArray array]; // just create with 0 size then later people will start throwing data at me with integer indexes (all un...