cocoa

Is this a good (Cocoa-like, Apple-approved) model class?

I've been using Objective-C for a while, but I've not been following Apple's guidelines very well. Recently I read Cocoa Design Patterns and the Model Object Implementation Guide, and I'm trying to do some very simple things, but do them very well. Have I missed any major concepts? Please don't mention self = [super init]; that's been c...

Audio stream and QTKit error

I'm trying to stream audio from the web with QTKit. I used this code: movie = [[QTMovie alloc] initWithURL:[NSURL URLWithString:@"http://vipicecast.yacast.net:80/vra_webradio07"] error:&error]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieStateDidChange:) ...

NSUserDefault exists -iPHONE SDK

Hello everyone, How would I check in a "if" statement if the NSUserDefault object is saved there or not? I'm not really sure how to call it.. So a pretty short question.. Thanks ...

Grouping a Core Data data result?

I am prototyping an idea on the iPhone but I am at the SQLite vs CoreData crossroads. The main reason is that I can't seem to figure out how to do grouping with core data. Essentially I want to show the most recent item posted grouped by username. It is really easy to do in a SQL statement but I have not been able to make it work in co...

Memory Management Question

Hi, i thought i getting the hang of Cocoa memory management, but apperently i have a lot more to learn. Take a look at this class i wrote: Word.h #import <UIKit/UIKit.h> @interface Word : NSObject { NSString *word; NSMutableArray *wordArray; } @property (nonatomic ,retain) NSString *word; @property (nonatomic ,retain) NSMut...

Xcode: Can't Build Downloaded Project because Compiler Cannot Find a Framework

I'm new to this so please make allowances. I'm trying to build Audioslicer which seems to need a framework called IntervalSlider. The IntervalSlider build fails with: framework not found InterfaceBuilderKit. However, the framework seems to be present under the Frameworks group with the necessary headers. Can anyone suggest what I'...

How to resize NSOutlineView column when scroller appears/disappears?

This ought to be very basic but after trying for an hour or so I can't figure out how to do this correctly: I have a NSOutline view with two columns, of which the right one should always be fully visible. The enclosing NSScrollView is set to show a vertical scroller only. Now whenever the vertical scroller appears it covers part of the ...

Significant difference between delegation and notification

Hi everyone I am reading the Cocoa Fundamentals->Design Patterns->Observer->Uses and Limitations. It mentioned a "significant difference from delegation" that confuses me: But objects receiving notifications can react only after the event has occurred. This is a significant difference from delegation. The delegate is given a chance ...

Using NSNumberFormatter to pad spaces between a currency symbol and the value

Hi Apologies if this is a dumb question but I'm trying to format a currency value for my iphone app and am struggling to left-justify the currency symbol, but right-justify the value. So, "$123.45" is formatted as (say) $ 123.45 depending on format-width. This is a kind of accounting format (I think). I've tried various methods with...

How to create a mail on Mail.app (Mac) with an image resource in the middle of the mail.

Hi, I'd like to create a mail (on a Mac with Mac OS X 10.5 and up) that has some text, then an image, then some more text, maybe another image, and maybe some more text... I understand that with the Scripting Bridge, I can add attachments to eMails, but they're always at the end of the Mail. Any idea how to get started here? Maybe use...

Using Core Animation with objects other than CALayers

I was pretty sure I had seen discussions of this around the Net, but now I can't seem to find anything. The question is simple: is there a way to use for example CABasicAnimation to animate a property on an object that's not a ´CALayer´? (Say, the ´volume´ property on an ´AVAudioPlayer´.) If not, is there a way to make it work other tha...

Objective-C :: using a method to change an object

I have a class called "CardSet", containing an NSMutableArray* cardSet to hold "cards", which I extend to make "DeckCards". I'd like "CardSet" to have a method called "(void)addCard:(Card*)" (and similarly a method "removeCard"). I'd like "addCard" to some how have access to and set cardSet. Even better I'd like to use the "addCard" meth...

Recording KeyCommands in a round view like tweetie or things preferences

How would you record the keystrokes in view and set them to the NSUserdefaults because every key has a numeric value and there are also modifier keys…how would u do this Thanks ...

Use image templates in buttons without borders

Hi, I'd like to use image templates on some of my buttons to have them behave as follow : Raised background in "normal" state, so the image appears engraved in the button When the button is pushed, the image turns to blue until it's released (like a selected toggle button) I need my button to be without borders I tried different com...

How to mix Qt, C++ and Obj-C/Cocoa

Hi, I have a pure C++/Qt project on a Mac, but I now find that I need to call a few methods only available in the Cocoa API. Following instructions listed here: http://el-tramo.be/blog/mixing-cocoa-and-qt I have a C++ class implementation in a ".m" file. As a test, my "foo.m" file contains the following code (relevant #include methods...

Is it possible to have "implementation-only" class members?

Hi, this is kind of a beginners question so please bear with me. I've got a class that makes use of a third-party library (oniguruma, if that matters). I want library methods to be completely decorated by my own, so that I can switch the underlying implementation of my class anytime. Something like: // MyClass.h @interface MyClass : N...

How do you live-filter an NSArray or NSMutableArray?

I'd like to have an NSArray or NSMutableArray that always shows a filtered view of a data set. That is, if the filter is set to "show me things with the letter a", and an item "blah" is added, that item would automatically show up in the list. However, if "bluh" were added, it would not show up in the filtered list (but would still reall...

All properties null inside dataOfType:error:

I'm creating a cocoa app with NSDocument architecture. Now I'm trying to save some data to a plist file inside dataOfType:error. Strange enough, every property in my document instance prints null when I try to access it inside that method. - (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError{ NSLog(@"dataOfType was cal...

Is this a correct summary of Cocoa reference counting?

Here's my understanding of it: Object are only retained (reference counter is incremented): when init from NSObject is called. when retain is called. Objects are only released (reference counter is decremented): when release is called. when an autorelease pool containing the object is drained And to clarify, autorelease does no...

NSPopup or something similar to indicate progress

I am not sure which class I need. I am looking to implement the following: User clicks on NSButton ( Have this working) Have a background task run once he does this. (have this working) While the task is in progress, I want to display a small popup which indicates the task is in progress and asks the user to wait/give him some more inf...