在 iOS 中从 EAGLView 切换到 UITableView
我正在开发一个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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论