Domanda

I am assigning value of latitude and longitude from one viewcontroller which are declared in another viewcontroller. but I am getting an error expression is not assignable

Here is my code:

mapVC.coordinate.latitude=[[tempArray objectAtIndex:9] doubleValue];

and here is my response:

 (
    17,
    TGB,
    Ahmedabad,
    "SG Highway",
    Dover,
    Georgia,
    388306,
    12345,
    "www.tgb.com",
    "37.23909",//latitude
    "-122.34567",//longitude
    "Dec 6, 2013 5:11:15 PM"
)
È stato utile?

Soluzione

You need to give the definition of your cell object and its properties.

You also need to describe your object graph. I gather it's an array that contains a dictionary, and that the key "latitude" in that inner dictionary contains an NSNumber or a string?

At a guess, your cell object's c1 property is of type CLLocationCoordinate2D.

When you have a property that's a struct, you can't change one part of the struct. Another issue: If your cell's c1 property is a CLLocationCoordinate2D, that's a scalar type. Your object structure (array that contains a dictionary?) can't directly contain a scalar value. It would have to be an NSNumber or (as the other poster suggested) an NSString)

You would have to rewrite it like this:

CLLocationCoordinate2D coordinate = cell.c1;
coordinate.latitude = [[[tempArray objectAtIndex:9] objectForKey:@"latitude"] doubleValue];
cell.c1 = coordinate;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top