Help with modal text input for a new table element

first, let me start by saying that I'm pretty new to the iPhone, so I apologize for my ignorance.

I have a UITableView in which I want to add new elements. When the add button is clicked, I want the modal screen to slide up, where the user enters text for a new item.

I read from Apple the Table Programming Guide for the iPhone , and they have an example that supposedly does what I want:

- (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];

}

However, they do not explain what itemInputController is. As far as I can tell, it should give me a modal view with one text box and a navigation bar with "Cancel" and "Save" in it. Should I create this view myself in the Builder interface? Or is it a standard thing that I need to import somehow? Can someone help me decrypt this or, conversely, show me another way to make it work?

+3
source share
1 answer

ItemInputController will be derived from the UIViewController that you need to add to your project.

UIViewController, IB - . UIViewControllers.

+1

Source: https://habr.com/ru/post/1708876/


All Articles