3

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

I've got a UITableView that I want to add new items to. When the add button is pressed, I want a modal screen to slide up where the user types in the text for the new item.

I've been reading from Apple's Table View Programming Guide for 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 don't explain anywhere what itemInputController is. As far as I can determine it is supposed to give me a modal view with a single text field, and a navigation bar with Cancel and Save in it. Am I supposed to create this view myself in Interface Builder? Or is it a standard thing I need to import somehow? Can anyone help me decipher this, or alternatively show me another way to get this working?

1 Answer 1

1

ItemInputController will be a derivitave of UIViewController that you need to add to your project.

You'll need to create a new UIViewController subclass, then build the interface in IB - see here for a discussion on building UIViewControllers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.