Mat*_*man 14 iphone uinavigationcontroller ios
仍然无法弄清楚我做错了什么.只是试图用里面的导航控制器获得模态视图.
这是我的项目 http://www.matthewpateman.com/New.zip
谁能告诉我我做错了什么?我希望"ShopModalView.xib"能够在导航控制器中弹出,但它只是在空白页面上进行了...
iwa*_*bed 45
将其显示为模态视图并将控制器包装在导航控制器中以提供导航栏,以防您想要添加编辑,保存等按钮
ModalViewController *modalController = [[ModalViewController alloc] initWithNibName:@"ModalViewController" bundle:nil];
modalController.delegate = self; // Set any delegate you may have
// This is where you wrap the view up nicely in a navigation controller
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:modalController];
// You can even set the style of stuff before you show it
navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
// And now you want to present the view in a modal fashion
[self presentModalViewController:navigationController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
对于那些想在 Swift 3.x 中执行此操作的人:
// Obtain your viewcontroller
let viewController = ...
// Initialize a navigation controller, with your view controller as its root
let navigationController = UINavigationController(rootViewController: viewController)
navigationController.navigationBar.barStyle = .blackTranslucent
// Present it modally from the current controller
present(navigationController, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
ShopModalViewController *shopMVC = [[ShopModalViewController alloc] initWithNibName:@"ShopModalViewController" bundle:nil];
//set properties
UINavigationContrller *navCon = [[UINavigationController alloc] initWithRootViewController:shopMVC];
[self presentModalViewController:navCon animated:YES];
[shopMVC release];
[navCon release];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
31321 次 |
| 最近记录: |