ios - pushViewController 做一个黑色 View

标签 ios objective-c ios6 uistoryboardsegue pushviewcontroller

我有一张显示很多注释的 map ,当我点击标注 annotationView.rightCalloutAccessoryView 中的 UIButtonTypeDetailDisclosure 时,我会看到一个空的黑色 View 。

-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
    NSLog(@"%@", view.annotation.title);
    MapPoint *annView = view.annotation;
    DetailViewController *dvc = [[DetailViewController alloc] init];
    dvc.titleLabel.text = annView.title;
    dvc.textView.text = annView.subtitle;
    [self.navigationController pushViewController:dvc animated:YES];
}

知道我做错了什么吗?

编辑: 我正在使用 Storyboard

最佳答案

如果您正在使用 Xib 接口(interface),那么您应该在将其压入堆栈之前分配 NibName。

使用介绍经纪商

DetailViewController *dvc = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];

使用 Storyboard

确保您已在属性检查器中为您的 View Controller 将标识符定义为“DetailViewController”。

DetailViewController *dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DetailViewController"];

关于ios - pushViewController 做一个黑色 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16145691/

相关文章:

ios - Barbuttons 正在离开位置

ios - 如何推送没有角标(Badge)编号的通知?

ios - Objective-C 中的键盘语言

Objective-C 库类别方法在 Swift 应用程序环境中不起作用

iphone - XCode 中神秘的不充分的堆栈跟踪没有给出错误发生位置的上下文

c++ - 访问给定的 future 后 boost::future<>.then() 中的错误访问

iphone - 将 double 组存储为 NSNumber

ios - 根据数组中的项目数量创建 View

iphone - 在输入过程中移动文本字段

ios - 在 iOS 7 中显示图像,但在 iOS 6.1 中不显示