【问题标题】:Presenting Modal TableView呈现模态表视图
【发布时间】:2010-07-05 10:52:28
【问题描述】:

我在一个类中有一个 tableviewController,我需要从另一个类以模态方式呈现。在 modaltableview 类中,我在 viewDidLoad 中创建 tableview,除此之外,该类中还有 tableView 委托方法。

我的问题是如何呈现这个类对象以模态显示这个 tableViewController? 我已经展示了来自同一类的 viewController:

  UIViewController *vw = [[UIViewController alloc]init];
  [self presentModalViewController:vw];

但是为另一个类的 viewController 写什么呢?我应该从这个类或 modaltableViewControler 类调用 presentModalViewController 吗?

附:我在当前 viewController 上已经有一个 modalViewController,我必须在其中展示新的 modalTableView。

提前感谢。

【问题讨论】:

    标签: iphone presentmodalviewcontroller


    【解决方案1】:

    在可见视图控制器中,创建并初始化模态 tableViewController 的实例。然后,仍然在可见的视图控制器中,调用[self presentModalViewController:<THE TABLE VIEW CONTROLLER YOU JUST INITIALISED> animated:YES];

    希望这会有所帮助!
    -jrtc27

    【讨论】:

    • 我已经尝试过了,但它甚至会破坏我现有的 modalViewController 并且也不会出现。我还尝试在现有的 modalView 上显示 modaltableView。我所做的是:[displayController prsentModalViewController:modalTableView animated:YES];其中 displayController 是我现有的 modalviewcontroller 并且在 tableview 类中我创建并将 tableview 添加到 self [self.view addSubview:modaltableView.view animated:YES];但是视图没有显示出来。我做错了吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多