objective-c

If NSDictionary is good for paired values, what is good for triple values?

NSDictionary is good for key-value pairs, by what data structure is best for when you have three values? Is is best to create a class for those 3 values, and then let each object in an array contain instances of that class? To be specific: The data structure, let's call it Person, I envisage has three values: (NSString)name, (int)age, ...

why co-cocoa pr-programmers st-stutter...

one of the things i like most about cocoa is the readability factor. but... one of the things that annoys me most is the convention of convenience constructors to stutter. what I mean is this: [NSString stringWithString:s] [NSNumber numberWithDouble:d] [NSValue valueWithInt:i] [NSDictionary dictionaryWithObjectsAndKeys:] etc... ...

What do I have to do to get Core Data to automatically migrate models?

I have read in the documentation about automatic /lightweight migration for Core Data models - but am having problems in the reality of implementing it. As I understand it the application should notice that the model it has and the model that exists on a device already are not the same. If you have only added attributes or relationships...

Shared Library for iPhone and BlackBerry

I have a set of functionality (classes) that I would like to share with an application I'm building for the iPhone and for the Blackberry (Java). Does anyone have any best practices on doing this? ...

Objective-C: Calling selectors with multiple arguments

In MyClass.m, I've defined - (void) myTest: (NSString *) withAString{ NSLog(@"hi, %@", withAString); } and the appropriate declaration in MyClass.h . Later I want to call [self performSelector:@selector(mytest:withAString:) withObject: mystring]; in MyClass.m but I get an error similar to * Terminating app due to uncaught excep...

how to generate buttons programatically?

hello i am stuck in a strange situation.i want to generate buttons on a view using a loop . suppose i want to generate 3 buttons.i have added a uiview btnframe to my main view.now i want to add button inside that view using that view's cordinates.how do i calculate btnframe's bounds. ...

Make NSRunLoop runMode:beforeDate: process mouse events

In a little game I am writing I have a method Player - (void)walkToPoint:(CGPoint)point I want this method to block, that is, it should not return before the player sprite reached the point. I though this would be relatively simple and can be done with NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; while(player.isMoving && [runLoop...

Fast enumeration in OS 3.0

I just tried compileing my iPhone app against OS 3.0 and I get a compile error when using fast enumeration. I'm trying to go through an NSArray containing cComment classes: for (cComment* newComment in comments.comments) And I get this error error: type of accessor does not match the type of property 'comments'. This works flawless...

Awaking Mac programatically

I want to write a custom alarm for a Mac that awakes the mac from sleep. I think it should be done as the Aurora app seems to do it. What methods/classes do I need to use? ...

Creating an Xcode data formatter bundle for custom Obj-C objects

To help simplify debugging of some custom Objective-C objects in the Xcode debugger window, I've created a set of data formatter strings for each of the objects, using the related Apple documentation and Xcode's built-in data formatters (in /Developer/Library/Xcode/CustomDataViews/) as a guide. My custom summary strings work great as a ...

Remote Desktop Protocol C or Objective-C Library

Does anyone know of a library for RDP that's written in C or Objective-C that is not GPLed? ...

What's missing in Cocoa?

If you could add anything to Cocoa, what would it be? Are there any features, major or minor, that you would say are missing in Cocoa. Perhaps there is a wheel you have had to invent over and over because of an omission in the frameworks? ...

Objective-C changes between OS 2.2.1 and OS 3??

When I tried compiling my app for OS 3 I encountered an the following error: error: type of accessor does not match the type of property The error was for a property I tried to access that is defined as follows: NSMutableArray *myArray @property (readonly,nonatomic) NSArray* myArray; the property is @synthesized in the implementati...

How to create relational object in Objective-c for iPhone

Here is the interface of my object: @interface MyItem : NSObject { sqlite3 *database; NSInteger *primaryKey; NSInteger *accountKey; NSInteger *categoryKey; NSString *title; BOOL hydrated; BOOL dirty; NSData *data; // Why do I need this? } The primary key will be auto generated in Sqlite and I am storing the integers, foreign k...

Can I boost::bind() to an Objective C function?

I have no idea if this is possible, but if it is, what would the syntax look like? If not possible, why not? ...

When do I define objective-c methods?

I'm learning Objective-C, and have a C/C++ background. In object-oriented C++, you always need to declare your method before you define (implement) it, even if it is declared in the parent class. In procedural-style C, IIRC, you can get away with just defining a function so long as it is only called from something else in the same ...

How to find available memory in iPhone programmatically?

I'd like to know how to find programmatically available memory in iPhone from Objective-C? ...

Help how to load UINavigationViewController from UIViewController

Hi, Here goes stupid question again :( I am trying to create a sample app that loads UIViewController when the app loads and the view contains a button to load UINavigationViewController. Now I created a project with "Window-based Application" and added "RootViewController" in the project with .m, .h, and .xib. Next I added a view and...

Separate NSArray to a list of NSString type objects

A UIActionSheet is initalized with: UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Title" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Button1", @"Button2", nil]; I am trying to pass an NSArray into the "otherButtonTitles" message. I tried to pass an NSArray using: ...

Convert .png to PVRTC *on* the iPhone.

Is there a standard mechanism or known library that will convert .png images to compressed PVRTC textures on the iPhone itself (not during development using the standard tools on OS X). I have a number of .png textures in my application but swapping is an issue. I'd like to create PVRTC variants of the .pngs on the device, should the av...