cocoa

cocoa hello world screensaver

I have been studying NSView and as such I thought I would give a shot at a screen saver. I have been able to display and image in an NSView but I can't seen to modify this example code to display a simple picture in ScreenSaverView. http://www.mactech.com/articles/mactech/Vol.20/20.06/ScreenSaversInCocoa/ BTW great tutorial that works...

NSMutableDictionary of NSMutableSets... sorting this out

I have a NSMutableDictionary of NSMutableSets. Each set entry is a string, something like this: NSMutableSet *mySet = [NSMutableSet setWithObjects: [NSString stringWithFormat:@"%f", time1], [NSString stringWithFormat:@"%f", time2], [NSString stringWithFormat:@"%f", time3], nil]; // time 1,2,3, are NSTimeInterval variables ...

MVC with cocoa/objective-c

Hi all, I have a strong j2ee background, and I am trying to move to objective-c for some desktop/iphone programming. I used many java web frameworks with mvc in mind, spring and struts ecc... so I am used to have servlet or controller which pass attributes to jsp pages, which is the view. In jsp pages with jstl you can call this attrib...

creating custom event / signal on cocoa os x

I am not much familiar with developing application using cocoa on mac. Can some one help me with how can i create custom events or signals, and how to make sure thread acts when these are generated or triggered. Any help will be appreciated. ...

how to detect network event in cocoa osx.

Is it possible to make sure my thread reacts on whenever there is network available ? Basically my thread should automatically get event that network is available and perform certain task. Any help will be appreciated. ...

CTFramesetter with non-rectangular path

May CTFramesetter have a non-rectangular frame/path? So far all tests causes crash whenever the path is not rectangular... ...

How to connect Model through Controller to View using bindings?

I have an NSTextField in my view. Its value is bound to an NSNumber *number in my controller. The controller simply calls through to the model (value) to get the appropriate value. // In the controller - (NSNumber *)number { return [NSNumber numberWithFloat:[model value]]; } - (void)setNumber:(NSNumber *)aNumber { [model setValu...

Leak in NSScanner category method

I created an NSScanner category method that shows a leak in instruments. - (BOOL)scanBetweenPrefix:(NSString *)prefix andSuffix:(NSString *)suffix intoString:(NSString **)value { NSCharacterSet *charactersToBeSkipped = [self charactersToBeSkipped]; [self setCharactersToBeSkipped:nil]; BOOL ...

Adding methods to an Objective C class interface is optional?

Coming from a C++ background, one thing that confuses me about Objective C is the fact that you can add a method to a class without actually specifying it in the class interface. So I had a barrage of questions: Why would someone choose to not add the method in the class interface? Is it simply because of visibility? Methods without ...

Cocoa - array not sorting?

I have this set NSMutableSet *mySet = [NSMutableSet setWithObjects: @"2", @"8", @"7", @"0", @"3", nil]; I copy the set to an array and sort it using NSArray *sortedArray = [[mySet allObjects] sortedArrayUsingSelector:@selector(compare:)]; The resulting array is in exactly the same order as the set and is not being sorted. Why? tha...

Cocoa: NSApp beginSheet sets the application delegate?

I am trying to display a custom sheet in my application, but I think I am doing something wrong. While everything seems to be working just fine, I have a rather odd side-effect. (which took hours to figure out). It turns out that everytime I display a sheet in my application, the Application delegate gets set to the instance of the sheet...

object cannot be set - either read-only property or no setter found

I am having trouble over simply assigning a value to a UI Button: //Assume rect is defined rect = CGRectMake(13, 10, 48, 48); profileButton = [[UIButton alloc] initWithFrame:rect]; profileButton.buttonType = UIButtonTypeCustom; I am getting "object cannot be set - either read-only property or setter found" when trying to assign the bu...

Build a custom folder in cocoa

I want to build an application that basicly acts as an desktop folder but with extended capabilities. But i have no idea how to start. If anyone has done eomethibg like this i would be really glad for any kind of hint. ...

Determine when a NSOpenPanel will close

I'm trying to determine when an NSOpenPanel is closing before it actually closes. I need to do this so I can overlay another window with a screenshot of the open panel on top of it to be animated. Unfortunately, all the notifications that you seem to be able to access seem to fire AFTER the window's already been closed. This leads to a ...

Construct NSTabView filling multiple NSTabViewItems by binding to DefaultUserPreferences...

So I have a single window applications with a NSTabView and I would like to populate a the NSTabViewItems by binding to DefaultUserPreferences that is connected to a plist like: --- <key>Tabs</key> <dict> <key>0</key> <dict> <key>tabName</key> <string>Default</string> <key>appUrls</key> <array> <string>file://localh...

Should I always release self for failed init methods?

Should I always release self when there is a failure inside init, or should I only do so if I have initialized instance variables first? To put it another way, is this pattern valid? Is there a time when I shouldn't release self inside an init method, or should I assume that if the control flow enters init, self has at least a retain co...

What changes in Core Data after a save?

I have a Core Data based mac application that is working perfectly well until I save a file. When I save a file it seems like something changes in core data because my original fetch request no longer fetches anything. This is the fetch request that works before saving but returns an empty array after saving. NSEntityDescription *outp...

Is it possible to embed a TTF or OTF font file in a C++ application?

Is it possible to embed a TTF or OTF font file in a C++ application so that application can use it without installing it on target machine? Any thoughts are welcome. (target platforms are going to be Windows and Macintosh). Purpose: Font is a private one and should not be available to the users. ...

CFPreferences creates multiple files

I have only a little question: Why the CFPreferences-API creates multiple files in my UserPrefs-Directory? All the files have my Bundle-Identifier as name and all (except the one, the original) have added a suffix like this: com.myComp.myApp.plist <- (only this plist-file should be created) com.myComp.myApp.plist.0qzcicc com.myComp.my...

How do I correctly modify a custom cocoa framework?

Hello, I'm working with the very-useful ID3 framework in my cocoa project. There's one tiny thing I'd like to modify in it, but I can't seem to get the changes I've made to apply to the built framework. The source code provided with the framework comes with an Xcode project, so I've opened that up and for testings sake put an NSLog(@"h...