我有一个UIViewController(主 VC),UIView当点击按钮时,另一个作为子视图加载到其中MainViewController。实际上我在主视图控制器中加载了一个地图视图作为子视图。为此,我需要将坐标传递MainViewController给子视图(地图视图)以创建annotation那里然后加载到MainViewController.
在MainViewController以下方法中正确加载子视图:
-(IBAction)showUserLocation{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"UserCurrentLocationView" owner:self options:nil];
UIView *currentLocationView = [nib objectAtIndex:0];
currentLocationView.frame = CGRectMake(8, 10, currentLocationView.frame.size.width, currentLocationView.frame.size.height);
[thirdPortion addSubview:currentLocationView]; // thirdPortion is a View Outlet in the Main VC wh
}
在这里,我想将坐标(纬度/经度)传递给UserCurrentLocationView's 类,以便它可以准备地图,并且我可以在按钮调用MainViewControllerwhenshowUserLocation方法中看到指向的地图。
UIView设置保留在(子视图)上的属性值的方法是什么MainViewController。
提前致谢!