Adding a navigationController by code, and add UINavigationBarItem on both left and right hand sides.
FirstViewControllerDelegate.h
#import <UIKit/UIKit.h>
#import "XDreamViewControllerViewController.h"
@interface XDreamAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong,nonatomic) UIWindow *window;
@property (strong,nonatomic) XDreamViewControllerViewController *viewController;
@end
FirstViewControllerDelegate.m
#import "XDreamAppDelegate.h"
@implementation XDreamAppDelegate
@synthesize window = _window;
@synthesize viewController=_viewController;
- (BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]];
// Overridepoint for customization after application launch.
self.window.backgroundColor = [UIColorwhiteColor];
self.viewController=[[XDreamViewControllerViewControlleralloc] initWithNibName:@"Main"bundle:nil];
UINavigationController*navigationController=[[UINavigationControlleralloc] initWithRootViewController:self.viewController];
self.window.rootViewController=navigationController;
[self.windowmakeKeyAndVisible];
return YES;
}