在 iOS 中从 EAGLView 切换到 UITableView

发布于 2024-12-11 07:44:28 字数 1222 浏览 0 评论 0原文

我正在开发一个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 替换为基于表格的视图?

I am working on a map navigation application for the iOS system. I currently have the map loaded in an OpenGL ES 2.0 view, which allows me to scroll etc. On the map I have placed a UIButton which should take me to a UITableView to select a destination; the code is below:

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];

This triggers this method:

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

But it fails to load the XIB, it just quits on the button press with the "program received signal SIGABRT" error.

Also the OpenGL map view is based within a tabbed view, it is one of several options; here is the init code of the OpenGL map view:

- (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;
}

How do I go about swapping out an EAGLView for OpenGL with a Table based view correctly?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文