NEUE LÖSUNG
versuchen, diese
in AppDelegate.m
@implementation AppDelegate
{}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UINavigationController *_navController = [[UINavigationController alloc] init];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = _navController;
ViewController* _viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
[_navController pushViewController:_viewController animated:YES];
return YES;
}
in ViewContoller.m jetzt wird diese Arbeit:
UINavigationController *nav = self.navigationController;
[nav pushViewController:controller animated:YES];
alte Lösung
diesen Code versuchen
in AppDelegate.h sicher sein, dies haben mindestens
@interface AppDelegate : NSObject <UIApplicationDelegate>
{}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navController;
@end
in AppDelegate.m zumindest diese
@implementation AppDelegate
{}
@synthesize window=_window;
@synthesize navController=_navController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UINavigationController *_navController = self.window.rootViewController;
UIViewController* _viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
[_navController pushViewController:_viewController animated:YES];
return YES;
}
@end
in Storyboard sicher sein, ein Navigation binded zu einem Viewcontroller geschaffen haben, als Anfang View-Controller definiert und als Root-View-Controller für die binded binded view controller
in der App allgemeine Einstellungen Registerkarte sicher sein, das Storyboard in der Deployment-Info-Abschnitt gesetzt haben (auch in diesem Abschnitt könnten Sie set Statusleiste Stil)
in ViewContoller.m jetzt wird diese Arbeit:
UINavigationController *nav = self.navigationController;
[nav pushViewController:controller animated:YES];
die navigationbar Stil bearbeiten Sie es auf diese Weise tun können
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
}
Ich habe es versucht. Aber nicht arbeiten –
Versuchen Sie einfach mit [_window setRootViewController: nav]; anstelle von window.rootViewController = nav; –