【发布时间】:2011-01-20 10:42:03
【问题描述】:
我发现这段代码可以显示一个模态视图:
- (void)add:(id)sender {
// Create the root view controller for the navigation controller
// The new view controller configures a Cancel and Done button for the
// navigation bar.
RecipeAddViewController *addController = [[RecipeAddViewController alloc]
initWithNibName:@"RecipeAddView" bundle:nil];
addController.delegate = self;
// Create the navigation controller and present it modally.
UINavigationController *navigationController = [[UINavigationController alloc]
initWithRootViewController:addController];
[self presentModalViewController:navigationController animated:YES];
// The navigation controller is now owned by the current view controller
// and the root view controller is owned by the navigation controller,
// so both objects should be released to prevent over-retention.
[navigationController release];
[addController release];
}
我的问题是如何实现这段代码(我将把它放在 buttonPress 方法中)
我需要在头文件中定义任何内容吗?让我困惑的一点是,apple on 提供了这个并且没有头文件,所以我不知道是否应该有任何东西?
代码指的是 RecipieAddViewController 我用什么来代替它,“UIViewController”?
我在头文件中作为委托放置了什么?我需要在其他任何地方进行设置吗?喜欢房产吗?
在我的 buttonPress 方法中添加了这段代码后,我还需要做什么才能使其工作吗?
感谢和抱歉所有问题。
【问题讨论】:
标签: objective-c iphone xcode uiview ipad