CurrentViewController.h
#import <UIKit/UIKit.h>
#import "nextNavViewController.h"
@interface CurrentViewController : UIViewController
{
nextNavViewController *contr;
}
- (IBAction)showNavView:(id)sender;
@end
CurrentViewController.m
/*..........*/
- (IBAction)showNavView:(id)sender {
contr = [[nextNavViewController alloc]initWithNibName:@"nextNavViewController"bundle:nil];
[self presentViewController: contr animated:YES completion:nil];
}
/* ......... */
nextNavViewController.h
#import <UIKit/UIKit.h>
@interface nextNavViewController : UINavigationController
@end
我有“nextNavViewController.xib”,其中包含一个表格,一些按钮和自定义导航栏。我希望加载此接口,但它加载空白屏幕的空白导航栏。
我做的事情可能吗?我需要做什么才能加载自定义界面?
答案 0 :(得分:5)
有几件事:
1)小心你的课程名称。确保他们遵循objective-c standards
2)您不需要对UINavigationController
进行子类化。如果您想获得UINavigationController
的一些功能,只需:
contr = [[nextNavViewController alloc]initWithNibName:@"nextNavViewController"bundle:nil];
UINavigationController *myNavigation = [[UINavigationController alloc] initWithRootViewController:contr];
[self presentViewController:myNavigation animated:YES completion:nil];