Ios 处理开始/结束外观转换的不平衡调用
我使用的是带有简单注释标注的mapView。我使用了下面的委托方法Ios 处理开始/结束外观转换的不平衡调用,ios,mkmapview,segue,viewcontroller,Ios,Mkmapview,Segue,Viewcontroller,我使用的是带有简单注释标注的mapView。我使用了下面的委托方法 - (void)mapView:(MKMapView *)_mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { lbhProfileMapPoint *mp = (lbhProfileMapPoint *) view.annotation; NSLog(@"mp
- (void)mapView:(MKMapView *)_mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
lbhProfileMapPoint *mp = (lbhProfileMapPoint *) view.annotation;
NSLog(@"mp objectID: %@", mp.objectID);
self.objectId = mp.objectID;
[[lbhVariables sharedInstance] setMapViewChosenObjectId:self.objectId];
//[self performSegueWithIdentifier:@"profileSegue" sender:self];
lbhProfileViewController *pvc = [[lbhProfileViewController alloc] init];
[pvc setObjectId:self.objectId];
[self.navigationController pushViewController:pvc animated:NO];
}
它不会转到viewcontroller,但一直在说
Unbalanced calls to begin/end appearance transitions for <lbhProfileViewController: 0x1f017ec0>.
在代码中,但如果改用此方法,它仍然会给我不平衡的调用。如果使用
performsguewithidentifier:sender:
方法,则还应使用prepareforsgue:sender:
方法。prepareforsgue:sender:
方法中的代码如下:
-(void)prepareForSegue:(UIStoryBoardSegue*) segue sender:(id) sender
{
if([segue.identifier isEqualToString:@"profileSegue"]){
lbhProfileViewController *pvc = [segue destinationViewController];
[[segue destinationViewController]setObject:sender.objectId];
}
}
此外,要使用此方法,还需要一个segue从调用map delegate方法的视图控制器直接连接到lbhProfileViewController
。我找到了答案
在ViewDidDemouse方法中,我正在执行self.navigationController弹出方法,因此它与此冲突
但这是有帮助的,谢谢 segue应该直接从VC连接到lbhProfileViewController,对吗?我不知道如何从callout按钮连接到DestinationController哦!而且profileViewController有两个ContainerViews…FYIIt不管profileViewController是否有两个容器视图。如果已启用序列图像板,则需要将带有mapView的viewController的segue连接到profileViewController。这可以通过右键单击情节提要中的viewController并拖动到profileViewController的连接来完成。另外,不要忘记命名您创建的segue。
-(void)prepareForSegue:(UIStoryBoardSegue*) segue sender:(id) sender
{
if([segue.identifier isEqualToString:@"profileSegue"]){
lbhProfileViewController *pvc = [segue destinationViewController];
[[segue destinationViewController]setObject:sender.objectId];
}
}