请执行以下操作:
在 AppDelegate.h
@property (nonatomic, retain) UINavigationController *navigationController;
在 AppDelegate.m
@implementation AppDelegate
@synthesize navigationController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
} else {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
}
self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
当你想推送下一个视图控制器时,你可以编写上面的代码:
-(void)fontButtonPress{
FontViewController *fontViewController = [[FontViewController alloc] initWithNibName:@"FontViewController_iPhone" bundle:nil];
[self.navigationController pushViewController:fontViewController animated:YES];
}
如果您有任何问题,请告诉我。
谢谢