Java Ka Baby
Java Ka Baby

Reputation: 4920

How can I typecast an NSArray element to double?

An other way please.
I have an array whole elements are doubles. How can I get the content out as double?e.g.

coordinate.latitude = [coords objectAtIndex:0];// value inside it is 61.2180556;

Upvotes: 0

Views: 205

Answers (1)

taskinoor
taskinoor

Reputation: 46027

You can't store primitive doubles in NSArray. You have either stored them as NSNumber or NSString. In either case use:

coordinate.latitude = [[coords objectAtIndex:0] doubleValue];

Upvotes: 2

Related Questions