cocoa

MVC and cocoa bindings best practices question

Lets say I have a view, myView, a view controller, myViewController, and some sort of model object, myModel. Further, lets say the model has two KVO compliant properties, arrayOfPeopleNames and arrayOfAnimalKinds (both NSStrings). In my view I want to have two pop-ups bound to the contents of these two arrays. My question is, if myCont...

A good place to find frameworks with Interface Builder plug-ins…

Someone on here recently recommended BWToolkit, and it really impressed me, so I started googling for more IB plug-ins. I've found a couple on random blogs, but haven't been able to find any kind of repository/aggregator for them. Anyone know where I can find more of these? Thanks. ...

Cocoa equivalent of .NET's Environment.SpecialFolder for saving preferences/settings?

How do I get the reference to a folder for storing per-user-per-application settings when writing an Objective-C Cocoa app in Xcode? In .NET I would use the Environment.SpecialFolder enumeration: Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); What's the Cocoa equivalent? ...

How do I force an NSPopUpButtonCell to redisplay itself?

I'm creating a custom subclass of NSPopUpButton and NSPopUpButtonCell to display a lone icon on top of the button instead of the usual text. To do this I'm overriding - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView in my button cell subclass to draw my icon at the appropriate size and location. When the ...

Is a keyframed transition possible in Core Animation?

I know that keyframed transitions are possible in Core Animation via setting the path property on the CAAnimation instance. However, CATransition does not seem to have this functionality. Does anyone know any other ways to control the transition apart from setting the timing function? ...

How to I change the main menu in Cocoa?

I have a cocoa app with two types windows each of which requires a different main menu to be displayed. In my MainMenu.xib I have the default MainMenu. In Window1.xib I have Window1 and in Window2.xib I have Window2 and it's MainMenu. When I have the first Window open I have the default Menu, when I open Window2 I get it's menu. Howev...

Memory leaks in newly created Cocoa app when using Garbage Collection?

I decided to use the GC for memory management for my latest Cocoa project, and I discovered something interesting--if I create a brand new Cocoa app project in Xcode, turn GC to supported or required (I tried both), build, and run it it leaks, it shows memory leaks! Mostly large numbers of tiny leaks of objects of type NSCFData, General...

How easy to get started on making apps for Mac?

I've done some delving into AppleScript but I'm interested in how difficult and long it would take to make semi-useful Mac apps. What really good resources besides Apple Documentation? ...

Is it necessary to override bind:toObject:withKeyPath:options: in an NSView subclass to implement binding?

I have an NSView subclass which has property which I want to be bindable. I've implemented the following in the subclass: myView.h: @property (readwrite, retain) NSArray *representedObjects; myView.m: @synthesize representedObjects; +(void)initialize { [self exposeBinding: @"representedObjects"]; } -(void)bind:(NSString *)bi...

Temporary text attributes causing massive slowdown

I am using the code I posted as an answer to this question to display hidden characters in an NSTextView as bullets. I am coloring the bullets gray with the addTemporaryAttributes:forCharacterRange: method of NSLayoutManager. Each range is of length 1 and colors a single bullet. (Most of the same text I am using has relatively few adj...

Helper functions in Cocoa

What is the standard way of incorporating helper/utility functions in Obj-C classes? I.e. General purpose functions which are used throughout the application and called by more than 1 class. Can an Obj-C method exist outside of a class, or does it need to be a C function for it to have this kind of behaviour? ...

Are there any commercial add on programming controls for Mac Cocoa/Objective C?

If developing for the Windows .NET APIs I can augment my efforts with 100's of commerically available add-on controls, graphing APIs and other usefull stuff. Can anyone point me in the direction of similar commerical software for Mac Cocoa/Objective C development? Additionally: Are there enough developers to do this commercially? The ...

Using Interface Builder tags

I'm using interface builder's tag feature to access some UILabels I'm instantiating in a xib file. Since this a UITextViewCell I want to avoid superfluous method calls, but I want to do it right too. Thus when I do: UILabel *label = (UILabel *)[cell viewWithTag:1]; I'm wondering if I should wrap it up like so: if([[cell viewWithTag:1...

Dealing with variable assignments and async requests

I'm looking for a reliable design for handling assignments that have asynchronous requests involved. To further clarify, I have a class which handles Data Management. It is a singleton and contains a lot of top level data for me which is used throughout my iPhone application. A view controller might do something such as the following: ...

How do I find the correct case of a filename?

This is on the Mac: If I have two filenames /foo/foo and /foo/FOO they may refer to the same file or the may be different files depending on the file system. How do I figure out if they are both pointing to the same file? And if they are, how do I get the correct representation of the filename? My problem is caused by links. A link mig...

Undo and Object release

Newbie question. I have a NSMutableArray that holds multiple objects (objects that stores bezier paths and related variables e.g. path colour ect.) These are properly released whenever the relevant -dealloc method is called. Each object is instansiated with +alloc/-init and added to the array. After adding them to the array I release th...

Learn Obj-C Memory Management

I come from a web development background. I'm good at XHTML, CSS, JavaScript, PHP and MySQL, because I use all of those technologies at my day job. Recently I've been tinkering with Obj-C in Xcode in the evenings and on weekends. I've written code for both the iPhone and Mac OS X, but I can't wrap my head around the practicalities of me...

Calculating Connection/Download Speed

I have a client and server program (both in Obj-C) and I am transferring files between two devices using the programs. The transferring is working fine, but I would like to display to the user what transfer rate they are getting. So I know the total size of the file, and how much of the file has been transferred, is there a way to figu...

How much RAM is there in an iPhone?

Different iPhones have different published memory 4GB, 8GB and 16GB. The touch can have 32GB. My understanding is this is the off-line memory (disk alike). How much actual fast ram is there in the device available for my Cocoa Application? Is there a preconfigured virtual amount? ...

Cocoa Interface Style

I'm on a project doing an iPhone application. We had a Cocoa consultant come in for a few weeks. He showed me an interesting idiom of Cocoa, dealing with interfaces, but there was a difficult language barrier between us, and he wasn't really able to explain why this was done or where it was documented so I could learn more on my own. I w...