objective-c

ANSI Color extraction library in C/Objective-C

I'm seeking a library, or bit of code I can incorporate into a Cocoa project where I can turn a stream of text with ansi color control codes into an attributed string. There are many projects that do this, but having examined their code they're either messy or overly complex. Has anyone an idea of a simple piece of code, or library, or...

Objective-C error: initializer element is not constant

Why does the compiler give me the following error message on the provided code: "initializer element is not constant". The corresponding C/C++ code compiles perfectly under gcc. #import <Foundation/Foundation.h> const float a = 1; const float b = a + a; // <- error here int main (int argc, const char * argv[]) { NSAutoreleasePool...

Should I explicitly release?

Hello I currently have an array of strings, I'm getting a NSString object from this array by calling the -componentsJoinedByString: method. Example: NSString *someString = [[NSString alloc] initWithString: [myStrings componentsJoinedByString:@","]; Since -componentsJoinedByString: returns me an NSString, I'm assuming that it is not "...

What are some of the best online resources for learning Objective-C?

I'm a .NET programmer (C#) and want to learn to develop for the Mac. I'm not fluent in C/C++ but know enough to get my hands dirty, so I figure Objective-C shouldn't be too difficult. Does anyone have any good online resources they'd recommend for learning Objective-C? ...

Delegate as external class in Objective-C

I'm creating a simple project for iPhone, using XCode and Interface Builder. While I understand what a delegate is, I have a problem with using it. I have an UITextField in my interface. It displays keyboard when user taps on it, but I need to program manually how to hide keyboard. It can be done using delegates. So in IB, I'm taking Ob...

There is really something like Objective C++?

I'm reading a post about iPhone programming and I've noticed that the talk about Objective C++, the code shown in the post looks mainly like Objective-C but there also are several snippets in C++. Is it really possible to program Cocoa from C++? ...

Examples of Cocoa/Objective-C and Distributed Objects?

I am learning Cocoa and Objective-C (well, and C) to make a few Mac apps I've had floating around. I need to use Distributed Objects, but am having trouble finding simple, concise examples. Does anybody know of any? ...

How to show a local image in the webview?

I want to show a local image in the webview , How to do ? somebody has a easy demo ? thanks a lot!!! ...

Mouseover in NSTableView

I'm having trouble creating a mouseover function with an NSTableView. The idea is that (if the feature is selected in prefs) placing the mouse pointer above a particular row in an NSTabelView will display a small popup window with additional information regarding the entry in that particular row. The effect should not be immediate (as e....

Caching the struct Object

How do I create a cache for a struct pointer object in Objective-C? Is there any third party component for caching objects as Java and .NET have? I have the following struct: typedef struct _news { references char *headline; char *story_url; } news; I have a double pointer for the above struct in an interface class. I would lik...

How do I record and play back sound on the iPhone?

In my app I've got certain buttons which use the following code: SystemSoundID beep; CFStringRef beepPath = (CFStringRef) [NSString stringWithFormat: @"%@/SoundFile.aif", [[NSBundle mainBundle] bundlePath]]; AudioServicesCreateSystemSoundID (CFURLCreateWithFileSystemPath (NULL, beepPath, kCFURLPOSIXPathStyle, false), &beep); CFRelease(...

What's the difference between declaring a variable "id" and "NSObject *"?

In Objective-C, what's the difference between declaring a variable id versus declaring it NSObject *? ...

Why NSUserDefaults failed to save NSMutableDictionary in iPhone SDK?

I'd like to save an NSMutableDictionary object in NSUserDefaults. The key type in NSMutableDictionary is NSString, the value type is NSArray, which contains a list of object which implements NSCoding. Per document, NSString and NSArray both are conform to NSCoding. I am getting error : -[NSUserDefaults setObject:forKey:]: Attempt to i...

Google App Engine with ClientLogin Interface for Objective-C

I'm experiencing the same problem in this previous stackoverflow.com post. Specifically, I seem to be able to get the "Auth" token correctly, but attempts to use it in the header when I access later pages still just return me the login page's HTML. Following links related to this post, I've determined that you need to make a subsequen...

how can fixed maximum character of a text field in objective c + cocos2d ?

how can fixed maximum character of a text field in cocos2d ? ...

iPhone SDK: Welcome video

Right, I have a video ready for it to be played on start up of my iphone App. How can I get this implemented into my Xcode project? I would like it to load as soon as the app is loaded, and the after it is played, to follow onto the correct view controller where the main bulk of my programming is. ...

Sample Cocoa app, ref counting, [pool drain] yields EXC_BAD_ACCESS?

I'm working through Cocoa Programming for Mac OS X (3rd ed) and in chapter 4 I wrote this app: int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; //create the date object NSCalendarDate *now = [[NSCalendarDate alloc] init]; //seed random # generator srandom(time(...

Building Objective-C App with External Framework

I am integrating growl into my Objective-C app. However If I build and run my app without copying the Growl.framework to ~/Library/Frameworks or a corresponding location then my App fails to execute. I don't really fully understand Frameworks under objective-c, but I was wondering if there is anyway to include the Framework within my...

What does the NS prefix mean?

Many classes in Cocoa/Cocoa Touch have the NS prefix. What does it mean? Thanks ...

HashTables in Cocoa

HashTables/HashMaps are one of the most (if not the most) useful of data-structures in existence. As such, one of the first things I investigated when starting to learn programming in Cocoa was how to create, populate, and read data from a hashtable. To my surprise: all the documentation I've been reading on Cocoa/Objective-C programmi...