带故事板的iPad上的UISplitViewController? [英] UISplitViewController on iPad with Storyboards?

查看:102
本文介绍了带故事板的iPad上的UISplitViewController?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Xcode中,我如何创建一个使用Storyboard的简单iPad应用程序,以便为每个条目换出DetailView控制器?我见过的大多数例子都使用iPhone,或者他们只是在同一个细节视图控制器中更改值。

In Xcode, how can I create a simple iPad application that uses Storyboards such that the DetailView controller is swapped out for each entry? Most examples that I've seen use the iPhone or they simply change the values in the same detail view controller.

我想从静态TableView控制器(比如3行)在Interface Builder中创建segue,其中每一行将加载一个不同的游戏细节视图控制器,我会在IB中拖出并设计。目前,当我使用segue连接视图控制器时,它将替换UISplitViewController的导航部分。换句话说,就像我正在穿越一棵树,我需要告诉IB我在根节点,我应该更改细节视图。

I want to create the segues in Interface Builder from a static TableView Controller (with say 3 rows) where each row will load a different game detail view controller, which I would drag out and design in IB. Currently, when I connect a view controller with a segue, it replaces the navigation part of the UISplitViewController. In other words, it's like I'm traversing a tree, and I need to tell IB that I'm at a root node and I should be changing the Detail View.

推荐答案

segues的一个很好的起点是斯坦福大学CS193p 2011秋季课程的第6和第7讲。

A good starting point for segues are Lectures 6 and 7 of Stanford's CS193p Fall 2011 class.

http://itunes.apple.com/us/itunes-u/ipad-iphone -application-development / id473757255

讲师Paul Hegarty涵盖了一切。但是,他在课程结束前用完时间来回答这个问题。他确实在文件中包含了最终解决方案的来源:Pill.zip博士的心理学家。

The instructor, Paul Hegarty, covers everything. However, he runs out of time before the end of class to answer this question. He does include the source with the final solution in the file: Psychologist with Dr Pill.zip.

http://www.stanford.edu/class/cs193p/cgi-bin/drupal/downloads-2011-fall

基本上,所有这一切需要完成的问题是从每个UITableCell按Ctrl键拖动到相应的游戏细节视图控制器,然后选择Replace segue。还有一个步骤,因为视图控制器将缩小,因为默认情况下Xcode认为您要替换主控制器。对于每个segue,选择连接线,然后在Attributes检查器中,将Destination从Master Split更改为Detail Split。此时,您可以使用popover进行测试,无需编写任何代码。

Basically, all that needs to be done for this question is to Ctrl-drag from each UITableCell to the respective game detail view controllers then select the Replace segue. There is one more step because the view controller will shrink because by default Xcode thinks that you want to replace the master controller. For each of the segues, select the connection line and in the Attributes inspector then change the Destination from "Master Split" to "Detail Split". At this point, you can test with the popover, without writing any code.

这篇关于带故事板的iPad上的UISplitViewController?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆