0

I have a map-controller where the user can tab the map to add a new marker. The idea is then to store the coordinates in the new marker-class. The problem I am facing is setting those variables.

NewMarkerController.h

@interface NewMarkerController : UIViewController
{
    NSNumber *posLat;
    NSNumber *posLng;
}

@property (nonatomic, retain) NSNumber *posLat;
@property (nonatomic, retain) NSNumber *posLng;

@end

I am also synthesizing this in the .m file is that makes any difference.

MapController.m

NewMarkerController *vc = [[NewMarkerController alloc] init];
[vc posLat:coordinate.latitude];

The last line shows an error saying No visible @interface for 'NewMarkerController' declears the selector 'postLat', but...there is...?

Can anyone spot the problem I am having here?

1
  • vc.posLat = coordinate.latitude; Commented Apr 10, 2013 at 21:47

2 Answers 2

2
[vc setPosLat:coordinate.latitude];

or

vc.posLat = coordinate.latitude;
Sign up to request clarification or add additional context in comments.

1 Comment

God damnit, i tried with SetPosLat, but I see now that it should be lowercased. Thanks! PS: Can't accept for another 11 min, so I'll do it asaic
1

This syntax:

[vc posLat:coordinate.latitude]

means that posLat is a function of the vc kind of class. As you want to set a variable, if you synthesized it you can just do:

[vc setPosLat:coordinate.latitude]

or

vc.posLat = coordinate.latitude

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.