0

我有一个视图控制器。该 viewController 有一个包含另一个控制器的 containerView。列表和地图。

我希望用户能够通过按钮在列表和地图之间切换。

这意味着父视图控制器(或某人)需要能够同时引用 mapViewController 和 ListViewController。

我怎样才能做到这一点?

一种方法是使用 instantiateViewControllerWithIdentifier。但是,我不喜欢标识符。标识符容易出现输入错误和冲突。我喜欢奥特莱斯

我读到这样做的一种可能方法是设置一个storyboardid。如果我喜欢旧的好插座怎么办?

4

1 回答 1

0

As I understand it, you have to sub view controllers. What I would do is create a master controller class, which imports all of the other view controllers (think of it as the super class of the entire project) which will then control a empty view, less a button. The background of the empty view will be fed by an "active" view, which will be supplied by either listViewController.h or mapViewController.h This will let the users use both the list/map VC's, and be able to switch between the two.

于 2012-09-30T15:49:24.407 回答