cocoa

Match first word of a phrase in a String.

I am using the GTMRegex class from the Google toolbox for mac (in a Cocoa / Objective-C) app: http://code.google.com/p/google-toolbox-for-mac/ I need to do a match and replace of a 3 word phrase in a string. I know the 2nd and 3rd words of the phrase, but the first word is unknown. So, if I had: lorem BIFF BAM BOO ipsem and lorem B...

When to use static string vs. #define

Hi all. I am a little confused as to when it's best to use: static NSString *AppQuitGracefullyKey = @"AppQuitGracefully"; instead of #define AppQuitGracefullyKey @"AppQuitGracefully" I've seen questions like this for C or C++, and I think what's different here is that this is specifically for Objective C, utilizing an object, a...

Cocoa: NSMutableString gives warning with stringValue

This works: NSString *myVar = @"whatever"; NSDecimalNumber *myNum = [NSDecimalNumber decimalNumberWithString:@"10"]; myVar = [myNum stringValue]; This version with mutable string produces warning "assignment from distinct Objective-C type": NSMutableString *myVar = [NSMutableString stringWithString:@"whatever"]; //UPDATE: CORRECT...

Cocoa: Testing to find if an NSString is immutable or mutable?

This produces an immutable string object: NSString* myStringA = @"A"; //CORRECTED FROM: NSMutableString* myStringA = @"A"; This produces a mutable string object: NSMutableString* myStringB = [NSMutableString stringWithString:@"B"]; But both objects are reported as the same kind of object, "NSCFString": NSLog(@"myStringA is type: ...

Xcode - how to include c library and header file to cocoa project?

How do I add c library to Xcode Cocoa project? Or what is the best option, I don't want to copy them into Cocoa project directory. I have a C project called a which compiles into library a.dylib and header file a.h, the project is located in it's own directory. I want to use this library from my objective-c application in Xcode. How ...

Cocoa webView to display a web page

Hello, I am trying to develop an export aperture plugin, I have designed some views/windows and everything runs smoothly, but trying to now add a webView on one of the window, and cannot make it to display the linked url (hard typed in the code). Is webView not supported because I'm running it within aperture? anyone having problem with...

How to implement Magnifier

how to implement magnifier tool in cocoa using obj c ...

Showing File Copy Status on a Progress Bar

Hello, I am trying to perform a low-level file copy but also display my progress using a determinate progress bar. Is there any way I can do this? I have looked on many mail archives, and one blog post explaining on how to do it in carbon which didn't work for me. ...

problem related to NSString

I have 1 NSString *abc = @"Hardik"; i have NSMutableArray *array; now i had written [array addobject:abc]; then i'm printing,NSLog(@"array = %@", array); but i'm getting NULL why? I have declared NSMutableArray *array; in a.h file i had set @property(nonatomic,retain)NSMutableArray *array; @synthesize array; and i have synthesize it ...

NSNumberFormatter subclass working in 10.6 but failing in 10.5 with generic error

Hi everyone. I'm subclassing NSNumberFormatter to allow the currency symbol to be optional. Here's my code: - (BOOL)getObjectValue:(out id *)anObject forString:(NSString *)aString range:(inout NSRange *)rangep error:(out NSError **)error { if (rangep == NULL){ NSRange newRange = NSMakeRange(0, [aString length]); ran...

get all methods of an objective-c class or instance?

In Objective-C i can test wether a given class or instance responds to certain selectors. But how can query a class or instance for all its methods or properties of a class (e.g. a list of all methods or properties)? Wether documented or not, it has to be possible as e.g. WebView can query a plugins scriptable object for all methods and...

Leaking memory with Cocoa garbage collection

I've been beating my head against a wall trying to figure out how I had a memory leak in a garbage collected Cocoa app. (The memory usage in Activity Monitor would just grow and grow, and running the app using the GC Monitor instruments would also show an ever-growing graph.) I eventually narrowed it down to a single pattern in my code....

Doing something wrong with bindings, can't find out what

Hi, I've a mutable array that holds instances of a model object. That model object has several properties one being "name". I have no problems initialising or populating the mutable array. I've a window with a drawer. I added a table to the drawer, the idea being that the drawer would use the table to display several instances of the m...

Application crashes on second select of same row

Hi all, I've run into a problem with an iPhone core data application that I'm working on. I have a table that lists objects. If I select one of those objects, I go to a new ViewController that shows the detail for the object. In the detail view, I have a back button that takes me back to the main list view. I can select any number of...

Xcode does not recognise methods added through categories

I've created a category to add methods to NSManagedObjectModel. Everything works fine except Xcode keeps throwing warnings about NSManagedObjectModel not implementing the methods. How can I force it to recognise the method? ...

Retain counts of IBOutlets

While coding always the same questions concerning retain counts of IBOutlets came along: Retain count after unarchiving an object from NIB? When to use @property's for an IBOutlet? Retain or assign while setting? Differences between Mac and iPhone? So I read The Nib Object Life Cycle from Apple's documentation. Some test apps on Mac and...

Embedding version control within App

I am building an application to learn cocoa, basically its a notes keeping app. But i wanted to build a functionality where i can see what happen to the document over time, i think using subversion/version control software can help me in this task. But how i can embed it within an app? ...

Embeding a Web Server in a Cocoa Application

I want to embed a simple web server into a cocoa application that can support dynamic operations, like processing form submissions. It should all be contained in the app. My first thought would be to include a Rails server, but something about that seemed wrong. Are there any examples of people integrating a web server in their app? ...

Is it possible to change the height/font size of an NSPathControl without subclassing NSPathControl/NSPathComponentCell?

I'd like to increase the height of an NSPathControl as well as make the font size larger. Is there any way to do it without subclassing the control as discussed here? ...

Using Objective C/Cocoa to unescape unicode characters, ie \u1234

Some sites that I am fetching data from are returning UTF-8 strings, with the UTF-8 characters escaped, ie: \u5404\u500b\u90fd Is there a built in cocoa function that might assist with this or will I have to write my own decoding algorithm. ...