Ios 在objective-c中的另一个类中设置变量

Ios 在objective-c中的另一个类中设置变量,ios,objective-c,Ios,Objective C,我有一个地图控制器,用户可以在地图上添加一个新的标记。然后将坐标存储在新的marker类中。我面临的问题是设置这些变量 NewMarkerController.h @interface NewMarkerController : UIViewController { NSNumber *posLat; NSNumber *posLng; } @property (nonatomic, retain) NSNumber *posLat; @property (nonatomic,

我有一个地图控制器,用户可以在地图上添加一个新的标记。然后将坐标存储在新的marker类中。我面临的问题是设置这些变量

NewMarkerController.h

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

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

@end
我还在.m文件中综合这一点,这会有任何不同

MapController.m

NewMarkerController *vc = [[NewMarkerController alloc] init];
[vc posLat:coordinate.latitude];
最后一行显示了一个错误,说明“NewMarkerController”的
无可见@interface将取消选择器“postLat”
,但是…有

有人能发现我这里的问题吗

[vc setPosLat:coordinate.latitude];

此语法:

[vc posLat:coordinate.latitude]
意味着posLat是vc类的函数。当您想要设置变量时,如果您合成了它,您只需执行以下操作:

[vc setPosLat:coordinate.latitude]

此语法:

[vc posLat:coordinate.latitude]
意味着posLat是vc类的函数。当您想要设置变量时,如果您合成了它,您只需执行以下操作:

[vc setPosLat:coordinate.latitude]


vc.posLat=坐标纬度
vc.posLat=坐标纬度天啊,我试过使用
SetPosLat
,但现在我发现它应该是小写的。谢谢PS:我不能再接受11分钟,所以我会像上帝一样做,我试着用
SetPosLat
,但现在我看到它应该是小写的。谢谢PS:再过11分钟我就不能接受了,所以我会尽快完成