1

我正在为 iOS 系统开发地图导航应用程序。我目前在 OpenGL ES 2.0 视图中加载了地图,它允许我滚动等。在地图上我放置了一个 UIButton,它应该带我到 UITableView 以选择目的地;代码如下:

UIButton *aButton = [UIButton buttonWithType:UIButtonTypeCustom];
[aButton setBackgroundImage:[UIImage imageNamed:@"buttonImage.png"] forState:UIControlStateNormal];
aButton.frame = CGRectMake(15, 15, 55, 55);
[self.view addSubview:aButton];  
[aButton addTarget:self action:@selector(switchViews) forControlEvents:UIControlEventTouchUpInside];

这会触发此方法:

UITableViewController* optionsController = [[UITableViewController alloc] initWithNibName:@"selectOptions" bundle:[NSBundle mainBundle]];
[self.view addSubview:optionsController.view];

但它无法加载 XIB,它只是在按下按钮时退出,并出现“程序收到信号 SIGABRT”错误。

此外,OpenGL 地图视图基于选项卡式视图,它是几个选项之一;这是OpenGL地图视图的初始化代码:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = NSLocalizedString(@"mapView", @"mapView");
        self.tabBarItem.image = [UIImage imageNamed:@"mapViewImage"];
    }
    return self;
}

如何正确地将 EAGLView 换成带有基于表格的视图的 OpenGL?

4

0 回答 0