如何在通用应用程序中加载 SplitViewController
这可能是一个直接的问题,但由于某种原因我无法让它工作。 我有一个通用应用程序,在开始屏幕(TTLauncher)上有图标,并使用 TTNavigator 推入视图控制器。
在其中一个图标上加载了一个普通的 tableView(对于 iPhone)。因为这对 iPad 来说不太好,所以我想加载相同的 tableView(如果可能的话,因为它包含所有逻辑,我可以调整代码以包含 splitview 所需的代码)。
但我该怎么做呢? 我创建了一个 UIViewController(称为 SplitViewController),其中包含一个包含 SplitViewController 的 XIB,并且为我的自定义 TableViewController 的 splitview 的 RootViewContorller 创建了类。
我认为如果将视图添加到 TTNavigator 中,它会起作用,但是什么也没发生:(
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"TEST!");
TTNavigator* navigator = [TTNavigator navigator];
[[navigator window] addSubview:splitViewController.view];
}
测试被调用) 我终于尝试了:
- (void)viewDidLoad
{
[super viewDidLoad];
//[self setView:splitViewController.view];
[window addSubview:splitViewController.view];
}
但仍然没有任何反应。我认为很明显我不明白这是如何工作的...... 有什么建议吗?或者我怎样才能更好地描述这个简单的问题?
This is probably a straight forward problem, but I for some reason cannot get it to work.
I have an universal app, with icons on the start screen (TTLauncher) and use TTNavigator to push in view controllers.
On one of the icons a normal tableView is loaded (for the iPhone). As that is not nice for the iPad, I want to load that same tableView (if possible, as it has all the logic in it, I can adjust the code to include the required code for the splitview).
But how do I do that?
I created a UIViewController (called SplitViewController), with a XIB in which I included the SplitViewController, and I made the class for the RootViewContorller of the splitview my custom TableViewController..
I thought it would work if I added the view to the TTNavigator, but nothing happens:
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"TEST!");
TTNavigator* navigator = [TTNavigator navigator];
[[navigator window] addSubview:splitViewController.view];
}
(Test is called)
I finally did try:
- (void)viewDidLoad
{
[super viewDidLoad];
//[self setView:splitViewController.view];
[window addSubview:splitViewController.view];
}
But still nothing happens. I think it is obvious that I don't understand how this works...
Any tips? Or how can I better describe this, I assume, simple problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论