objective-c

Cocoa one row table view or a horizontal list view

Is it posible to use table view to show just one row of a big amount of elements? What I'm looking for is for some kind of horizontal list, like we have in XCode preferences or Aperture image list. It would behave just like a one columnt table view, but instead of showing the elements vertically, it should be horizontally. Can you poin...

How do I get the default temporary directory on Mac OS X?

I'd like to create some directories of data for some unit tests and I'd like these directories to be in the default temporary directory for the user. I could just create a subdir under /tmp I suppose, but I don't want to make an assumption about how somebody has set up their own machine. I'm planning on writing the test data on the fly...

Code review for many-to-many relationship UI implementation in CoreData

Below is the "work horse" piece of code that I've implemented in order to display a many-to-many relationship in CoreData. My UI is on a screen called "Expense". This expense can be associated with many transactions. (Also, transactions can be associated with several expenses). The UI contains the currently selected expense, and a table...

Why does my nib's window close immediately?

I have a nib that I load the usual way [NSBundle loadNibNamed:@"AuthorizationWindow" owner:self]; and I see the window show on the screen briefly, and using NSLog() I can confirm that -awakeFromNib is called, but I can't figure out why the window does not stay on the screen. I had it working correctly for a bit, but now I'm not sure wh...

NSDictionary with ordered keys

I'm curious if this is a situation any other folks have found themselves in. I have an NSDictionary (stored in a plist) that I'm basically using as an associative array (strings as keys and values). I want to use the array of keys as part of my application, but I'd like them to be in a specific order (not really an order that I can wri...

Connecting to the Internet in an Xcode Application

Hi, The last GUI programming I have done was with Visual Basic, which included objects like Winsock and Inet to easily connect to the internet and retrieve the source from webpages. I just got started into XCode, and was wondering if there is a similar component. I see that there is a Webkit option in the Library, but I have no idea ho...

Determine Free Disk Space Allowed By Sandbox On iPhone

I am looking for a way to determine how much free disk space there is available to my application. I have tried using NSFileManager's fileSystemAttributesAtPath with NSFileSystemFreeSize, but this is giving me the total free space on the iPhone and not what is available to my application by the Sandbox. I believe applications are limit...

Abstract class memory management in Cocoa

When writing an abstract class, or a class that doesn't get instantiated directly... do you tend to write a dealloc method in the abstract class and release where appropriate, and then allow for children to call [super dealloc] and then worry about only instance variables they add which aren't part of the super class? How do you folks m...

Key-Value Coding with Objective-C

I had a straight forward approach of turning Key/Value pairs of an XML excerpt into an NSDictionary when I started a simple iPhone application. The problem is, I need to turn those NSDictionary's instances that once populated my UITableView's into custom classes because they require behavior and additional complexity. The problem here is...

Does Instruments (ObjectAlloc/Leaks) require the simulator?

This may be a very stupid question so I apologize in advance. It seems that Instruments only works for me when using the iPhone Simulator. Is there something special to getting it working when tethering the application to the iPhone? Or is that even possible? I launch the application the normal way through the Run->Start with performace ...

Assignment Makes Pointer from Integer Without a Cast

I have an Obj-C method similar to this: -(void)getUserDefaults:(BOOL *)refreshDefaults { PostAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; if (refreshDefaults) { [appDelegate retrieveDefaults]; } } When I call it like this I get no warning: [self getUserDefaults:NO]; When I call it like ...

Looking for info on custom drawing of interface components (Cocoa)

It seems like more and more OS X apps these days are doing all kinds of fancy drawing stuff for custom controls. Apps like Twitterific, Things, EventBox, Versions just to name a few.... So basically I'm looking for any information on how to get started doing this kind of thing. Not sure if it is just done by subclassing controls and usi...

C/objC/C++/Java compilers

I downloaded NetBeans (for first time) to use Java and found that it can handle C/C++ etc too. Wanted to know following -- 01- Is there any better C++ tool (IDE) other than NetBeans and MS Visual Studio? Better means very mature and popular (and free). 02- What is the difference between GNU Java and Sun Java compilers? 02- Is there...

Dynamically instanting classes in Objective-C, possible?

My problem is the following. I have a method which simply takes an XML excerpt and an XPath. It then should create me an array of objects for that XML excerpt. Meaning if I get passed the following XML: <user> <name>Bob</name> <age>50</age> </user> My method will instantiate an instance of the class User and use key-value-coding t...

Key-Value coding and its scripting capability

I have an object which straight forward instance variables. Some are NSString, some are unsigned ints, etc. I was under the impression Key-Value coding was scriptable in that I could write code such as the following: id key, value; key = [[attributes objectAtIndex:j] name]; value = [[attributes objectAtIndex:j] stringValue...

Overriding property accessor names in Objective-C with @synthesize

I'm trying to find documentation on how I can override a property name in Objective-C with @synthesize. If I have an instance variable name of 'foo', I want to write it's accessor as 'bar'. Doing something such as @synthesize foo = bar; gives a compile-time error. ...

Do I still need to learn about managing memory now that Objective-C/Cocoa has Garbage collection?

So I finally dusted off my Objective-C/Cocoa books.. turns out they are nearly 7 years old! With Objective-C 2.0 now having garbage collection, how important are the chapters on Memory Management? How much of a difference has Garbage Collection made? ...

Do I need to release IBOutlets when using loadNibNamed: method?

I have a .xib file containing a UIView and 2 UILabel subviews linked to a class named Note with outlets assigned to each label appropriately, the definition for this class contains the following. @interface Note : UIView { IBOutlet UILabel *time; IBOutlet UILabel *content; } I'm constructing this with the following code NSArr...

How do I pass variables between view controllers?

i'm having a hard time with Xcode; for some reason, it just won't let me pass a variable from one view controller class to another. It should work, i was basically just copying/pasting from my other classes (it works on all of them... except this one). I've been at it all night long, tried everything i could think of and still it remains...

How useful is the -[NSObject isMemberOfClass:] method?

Here's a small test program I wrote: #import <Foundation/Foundation.h> int main(int argc, char **argv) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSArray *arr = [NSArray array]; printf("Arr isMemberOfClass NSArray: %d\n", [arr isMemberOfClass:[NSArray class]]); printf("Arr isKindOfClass NSArray: %d...