1

CurrentViewController.h

#import <UIKit/UIKit.h>
#import "nextNavViewController.h"
@interface CurrentViewController : UIViewController 

{
nextNavViewController *contr;
}
- (IBAction)showNavView:(id)sender;

@end

当前视图控制器.m

/*..........*/
- (IBAction)showNavView:(id)sender {
    contr = [[nextNavViewController alloc]initWithNibName:@"nextNavViewController"bundle:nil];
    [self presentViewController: contr animated:YES completion:nil];


}
/* ......... */

下一个NavViewController.h

#import <UIKit/UIKit.h>

@interface nextNavViewController : UINavigationController

@end

我有“nextNavViewController.xib”,其中包含一个表格、一些按钮和自定义导航栏。我希望加载此界面,但它会加载带有空白屏幕的空白导航栏。

我正在做的事情可能吗?我必须做什么才能加载自定义界面??

4

1 回答 1

5

有几件事:

1)小心你的班级名称。确保他们遵循objective-c标准

2)您不需要子类 a UINavigationController。如果您想获得 a 的某些功能UINavigationController,只需:

contr = [[nextNavViewController alloc]initWithNibName:@"nextNavViewController"bundle:nil];

UINavigationController *myNavigation = [[UINavigationController alloc] initWithRootViewController:contr];

[self presentViewController:myNavigation animated:YES completion:nil];
于 2012-12-11T07:34:09.797 回答