objective-c

Sending data between ruby and objective-C

I'm trying to serialize data for sharing between Ruby and Objective-C. I would like to use something lightweight like YAML or JSON, but I would be curious to hear what would be the easiest implementation. Thanks. ...

Is it possible to implement the Haversine formula in Objective-C and call it from SQLite?

As I understand, SQLite doesn't have the math functions to properly implement the Haversine formula in straight SQL. I'm thinking this should be possible using an external function, with the implementation being in C. The goal is to have a SQLite database in an iPhone, and to be able to sort by the distance to the user's current locati...

Best implementation for iTunes-like playlist structure?

I'm creating an app that has a master-detail interface, similar to iTunes. It has the same data hierarchy as iTunes' playlists (except that I'm not allowing groups of "playlists" to keep things simple). In other words, there are normal playlists where their only items are added manually by the user. There are smart playlists, which sh...

didAccelerate doesn't fire???

I can't get didAccelerate to trigger. I have the delegate implemented in my header file. I've set a breakpoint in the method: - (void) accelerometer: (UIAccelerometer *)accelerometer didAccelerate: (UIAcceleration *)acceleration { int i = 0; } I've tried it with two different apps but still nothing. Any ideas on what I'm doing ...

EXC_BAD_ACCESS in didAccelerate on phone move

I'm doing the following: - (void) accelerometer: (UIAccelerometer *)accelerometer didAccelerate: (UIAcceleration *)acceleration { if (self.lastAcceleration) { double i = self.lastAcceleration.x; It works fine until I actually tilt the phone. Then I get EXC_BAD_ACCESS on the last line. lastAcceleration is a property with a retain. ...

Method to Display Cell Again in UITableViewController

Which method should I use in order to display a cell again in a UITableViewController? ...

iPhone OS memory problem - how to debug?

I have a pretty weird problem in my iPhone app which is, I think, related to memory getting corrupted: At one point, I need to sort an array, which I do with -[sortArrayUsingFunction]. The result is not correct unless I either allocate some memory with something like void *test = malloc(2 * sizeof( int )) before the method call or hav...

Knowing which image in a UIImageView Animation

Is there any way to know which image is currently being displayed in the built in animation within a UIImageView? I have 5 images which I need to animate through. The UIImageView provides a simple method to do this through the animationImageView.animationImages = [NSArray ...]; animationImageView.animationDuration = 5; animationImageVi...

How can I load a subview separately?

Hi guys, I have a MainView with a lot of subviews! In one of that subview there is a WebView that check if there is a connection. The problem is that check connection ALWAYS at the startup of my app.. I want load this subview only when is opened...is that possible?? this is my code: MainView.h #import <UIKit/UIKit.h> #import <Foundat...

[objective-c, NSMutableArray] about removeObjectAtIndex.

appdata.items is NSMutableArray object. source code -(void)deleteAppDataItemId:(NSInteger)identifier{ NSLog(@"%@", [appdata.items objectAtIndex:identifier]); NSLog(@"%i", identifier); [appdata.items removeObjectAtIndex:identifier]; } log 2009-11-08 21:53:01.683 xxx[14283:207] ( 200, "", 2009-11-08 21:52:53 +0...

Objective-C uses dynamic binding, but how?

I know that Objective-C uses dynamic binding for all method calls. How is this implemented? Does objective-c "turn into C code" before compilation and just use (void*) pointers for everything? ...

Dynamic binding seems like a lie.

Objective-C uses dynamic binding: that is method calls are resolved at runtime. Fine. And use of dot notation really boils down to a method call But, why then, can't I do something like this: #import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] ini...

Number of objects in an NSArray

Hi, I was wondering if there was any possible way to get the number (count) of objects in an NSArray Object ...

Objective-C "messages" - what's the right way to read it?

You can declare a method in objective-c and name each parameter twice, basically. I get the idea that this is powerful, but I'm not quite sure how to use it yet... When John Greets Kelly: [ p Greet:"John" toPerson:"Kelly" greetWith:"hey babe" ] ; Something about it doesn't read naturally. I'm not sure if that's how an experienced ob...

How do I check if a WebView is loading a specific page?

Hi guys! I want check if my WebView is loading a specific html page locally (for example index2.html). Is that possible? Thanks!! ...

C/C++/Objective-C text recognition library

Does anyone know of any free/open-source text recognition libraries in C/C++/Objective-C? Basically something that can scan an image, and read out all of the plain text. ...

How to tell if a given path is mounted removable media in Mac OS X?

Given a path, in Mac OS X, is there a way to tell that it is a mounted CD or DVD, as opposed to a regular directory, a regular file, or mounted DMG or other mountable file type? Specifically I would like to know if it is a CD or DVD when a user supplies a path directly, or via the NSOpenPanel, or drags the CD onto the app. I need to ta...

Cocoa-Touch: performSelectorOnMainThread: weird behavior + crash

I have a situation where I'm lazy loading images from the www. It's a list of items, when one item is tapped, a detail view is pushed to a nav controller. In that detail view the item has an image, which first is a default image, and I want to start loading it's image from a URL. So what I do is create an object which once initialized ...

How to block all input on iPhone app(for jailbroken devices) ?

I'm trying to block all user input in my app. That includes touch event,sleep button, home button, etc. It's for jailbroken device. So you can use whatever that works. Thank you! ...

How do I divide NSString into smaller words?

Greetings, I am new to objective c, and I have the following issue: I have a NSString: "There are seven words in this phrase" I want to divide this into 3 smaller strings (and each smaller string can be no longer than 12 characters in length) but must contain whole words separated by a space, so that I end up with: String1 = "Ther...