【问题标题】:Help with modal text input for new table item帮助新表格项的模式文本输入
【发布时间】:2010-10-28 03:55:59
【问题描述】:

首先让我说我对 iPhone 还很陌生,所以我为我的无知道歉。

我有一个要添加新项目的 UITableView。当按下添加按钮时,我想要一个模式屏幕向上滑动,用户输入新项目的文本。

我一直在阅读 Apple 的 Table View Programming Guide for iPhone,他们有一个可以满足我要求的示例:

- (void)addItem:sender {
// To add an item, display a modal view with a text field.
if (itemInputController == nil) {
    itemInputController = [[ItemInputController alloc] init];
}
// Use a navigation controller to provide a customizable navigation bar with Cancel and Done buttons.
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:itemInputController];
[[self navigationController] presentModalViewController:navigationController animated:YES];
[navigationController release];

}

但是他们没有在任何地方解释 itemInputController 是什么。据我所知,它应该给我一个带有单个文本字段的模态视图,以及一个带有取消和保存的导航栏。我应该在 Interface Builder 中自己创建这个视图吗?或者它是我需要以某种方式导入的标准东西?谁能帮我破译这个,或者告诉我另一种方法来让它工作?

【问题讨论】:

    标签: iphone uitableview uinavigationcontroller modal-dialog


    【解决方案1】:

    ItemInputController 将是您需要添加到项目中的 UIViewController 的派生类。

    您需要创建一个新的 UIViewController 子类,然后在 IB 中构建接口 - see here 以讨论构建 UIViewControllers。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-16
      • 2015-06-26
      • 1970-01-01
      • 2011-05-21
      相关资源
      最近更新 更多