3

首先让我先说我对 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 中自己创建这个视图吗?还是我需要以某种方式导入的标准东西?谁能帮我破译这个,或者告诉我另一种方法来让它工作?

4

1 回答 1

1

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

您需要创建一个新的 UIViewController 子类,然后在 IB 中构建接口 -请参阅此处了解有关构建 UIViewControllers 的讨论。

于 2009-05-22T09:00:22.333 回答