cocoa

Ideas for toy projects with which to familiarize oneself with Cocoa and Cocoa Touch

[Distilled from this question, with less informality.] What are some things a new Cocoa programmer should write as sample projects, outside of the hand-holding of a tutorial? Let's have one project idea per answer. If you have multiple ideas to suggest, post multiple answers. It'll help for you to also list what Cocoa concepts your pr...

How to launch an app in debug mode from xcode with a URL

Is there a way for xcode to launch an application with an app URL? I've read the answer to this question http://stackoverflow.com/questions/1239000/debugging-app-when-launched-by-push-notification, and it works great for single tests. I'm trying to write unit tests for launching the app with lots of different URLs, and using the previo...

Extract part of a NSString in Cocoa in an efficient way

Hi, How could I extract a part of an NSString before certain word(s): For example: If the keyword set of 'separators' is an NSArray of the following words "Series" and "documentary" and if the NSStrings where "Chain two Series documents" <---- I'd like to extract "Chain two" "Chain documentary documents" <---- I'd like to extract ...

In XCode, when you create an instance of a class in IB rather than in the code, what is the name of the instance object?

If I create a new instance of a class with IB I can't send messages to it because I don't know its name. I have asked several people and they always say 'you just use files owner' but that doesn't answer my question. What is the instances name? ...

Track all Objective-C's alloc/allocWithZone/dealloc

Sorry for long description, however the questions aren't so easy... My project written without GC. Recently I found a memory leak that I can't find. I did use new Xcode Analyzer without a result. I did read my code line by line and verified all alloc/release/copy/autorelease/mutableCopy/retain and pools... - still nothing. Preamble: St...

Should I define overloaded inherited method in the header file in ObjC?

Hi, well the question is the one I put in the title: "Should I define overloaded inherited method in the header file in ObjC?" Thanks UPDATE: I was wondering this because I will make my project's documentation using Doxygen, and maybe is better to declare overloaded inherited method because of the documentation. For example for method ...

Lego Mindstorm NXT, Cocoa, and HiTechnic Sensors

I've taken the existing code from this project, and very happy with it so far. I'm now however in a position where I need to make use of some third-party sensors which I've purchased from hitechnic, such as an accelerometer, a gyroscope, and a 3D compass - to mention a few. I'm not sure where to start now, but what I need to do is add ...

Custom Mac Scrollbars With Cocoa

How would I create custom scroll bars with cocoa? ...

Changing my CALayer's anchorPoint moves the view

I want to alter the anchorPoint, but keep the view in the same place. I've tried NSLog-ing self.layer.position and self.center and they both stay the same regardless of changes to the anchorPoint. Yet my view moves! Any tips on how to do this? self.layer.anchorPoint = CGPointMake(0.5, 0.5); NSLog(@"center point: %f %f", self.layer.posi...

play a movie in cocoa application

hi i want to know how to play a movie in Cocoa application ...

Objective-C: variable optimized away by compiler

I am trying to run the following code: 1. NSURL *checkLicenseURL = [NSURL URLWithString:@"check_license.php?accesskey=&license_key="]; // call server API 2. NSError *err = nil; 3. NSXMLDocument *xmlResult = [[NSXMLDocument alloc] initWithContentsOfURL:checkLicenseURL options:NSXMLDocumentTidyXML error:&err]; But when looking at variab...

Using NSWindowController to manipulate a window

I have the following code: AXWindowController *controller = [[AXWindowController alloc] initWithWindowNibName:@"ActivateWindow"]; [controller showWindow:nil]; How do I use controller to make changes to the window ActivateWindow (eg. changing text on the window, etc.)? Step by step instructions would be appreciated. Thanks! ...

Best way to handle malloc failure in Cocoa

Although it won't happen often, there are a couple of cases where my Cocoa application will allocate very large amounts of memory, enough to make me worry about malloc failing. What is the best way to handle this sort of failure in a Cocoa application? I've heard that Exceptions are generally discouraged in this development environment...

create iTunes playlist with scripting bridge

hey i am trying to create a new user playlist using the cocoa scripting bridge, but cannot seem to get it to work. i have so far: iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"]; SBElementArray *iSources = [iTunes sources]; iTunesSource *library = nil; for (i...

Program not supported on this type of mac computer

I have a piece of software that just entered beta. A Japanese version of Mac OS X runs it fine, but a German beta tester gets a message that loosely translates to "Cannot run program because it is not supported on this type of Mac computer." It is Intel and 10.6 only, but that is what the beta tester has. He tells me that the error sho...

NSArray element comparison to NSString

Hi, I am trying to find a word inside a phrase (NSString). For this I've exploded the components of the phrase into individual substrings and now I am trying to compare them to the word I am looking for, but it doesn't work. What would be the correct approach for this and fix for the software below? NSString *myString = @"Mi Programa...

Adding item to NSMenu with action selector preset

I'm new to Obj-C/Cocoa programming, and I'm having an issue trying to dynamically add menu items to an NSMenu instance and have the items action selector already set upon insertion. I can, add the dynamic menu items fine, but the action selector doesn't trigger when the item is clicked via the menu. The first line below is the line of ...

Are there any open source calendars that look like iCal that I can put in the lower bottom of my application?

I want to put a little calendar in the bottom corner of my application. I have checked out the Amber Framework, but have not figured out how to build it. I have also checked out Logan Rockmore's calendar, but when it is minimized, it does not work. Does anyone have any suggestions? ...

Why does the value of only one of my text fields change?

I have the following code: @interface AXWindowController : NSWindowController { IBOutlet NSTextField *text; IBOutlet NSTextField *otherText; } - (void) setText: (NSString *)input; - (void) setOtherText; @end @implementation AXWindowController - (void) setText: (NSString *)input { [text setStringValue:input]; } - (void) setOther...

Can I use a smaller buffer for NSFileHandleReadCompletionNotification?

I'm reading NSFileHandleReadCompletionNotification messages from the NSNotificationCenter to receive messages from an NSTask. The problem is that the command line program I'm calling is relatively slow to output lines, and it seems that the NSFileHandleReadCompletionNotification message gets posted relatively infrequently (I guess when t...