<span style="font-size:18px;">- (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]
init];
// Configure the RecipeAddViewController. In this case, it reports any
// changes to a custom delegate object.
addController.delegate = self;
// Create the navigation controller and present it.
UINavigationController *navigationController = [[UINavigationController alloc]
initWithRootViewController:addController];
[self presentViewController:navigationController animated:YES completion: nil];
}</span>【View Controller】Presenting a view controller programmatically
最新推荐文章于 2020-03-06 14:52:39 发布
本文介绍如何在iOS应用中使用导航控制器添加新的视图控制器,并配置了取消和完成按钮。具体步骤包括创建RecipeAddViewController实例并设置其代理,然后通过UINavigationController呈现新的视图控制器。

382

被折叠的 条评论
为什么被折叠?



