[英]Present UINavigationController from UIViewController
CurrentViewController.h CurrentViewController.h
#import <UIKit/UIKit.h>
#import "nextNavViewController.h"
@interface CurrentViewController : UIViewController
{
nextNavViewController *contr;
}
- (IBAction)showNavView:(id)sender;
@end
CurrentViewController.m CurrentViewController.m
/*..........*/
- (IBAction)showNavView:(id)sender {
contr = [[nextNavViewController alloc]initWithNibName:@"nextNavViewController"bundle:nil];
[self presentViewController: contr animated:YES completion:nil];
}
/* ......... */
nextNavViewController.h nextNavViewController.h
#import <UIKit/UIKit.h>
@interface nextNavViewController : UINavigationController
@end
I have "nextNavViewController.xib" which contains a table , some buttons and customized navigation bar. 我有“ nextNavViewController.xib”,其中包含一个表格,一些按钮和自定义的导航栏。 I want this interface to be loaded but it loads blank navbar with blank screen.
我希望加载此界面,但它会加载空白屏幕的空白导航栏。
Is the thing i am doing possible? 我正在做的事情可能吗? What i have to do to load the customized interface??
我必须做些什么才能加载自定义界面?
A couple of things: 有两件事:
1) Careful with the name of your classes. 1)小心您的班级名称。 Make sure they follow the objective-c standards
确保它们遵循Objective-C标准
2) You don't need to sub-class a UINavigationController
. 2)您不需要子类化
UINavigationController
。 If you want to receive some of the capabilities of a UINavigationController
, just: 如果您想获得
UINavigationController
某些功能,只需:
contr = [[nextNavViewController alloc]initWithNibName:@"nextNavViewController"bundle:nil];
UINavigationController *myNavigation = [[UINavigationController alloc] initWithRootViewController:contr];
[self presentViewController:myNavigation animated:YES completion:nil];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.