I am now using my navigation Item to create exit button (left navigation item). When it comes to creating the view controller embed in navigation view controller , it seems that we cannot exit the app by using popViewControllerAnimated and dismissViewControllerAnimated . WOuld you please tell me what to do ?
The below is my code for embed view controller
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    navigationBar =  self.navigationController.navigationBar;
    [navigationBar setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
                                           [UIColor whiteColor], NSForegroundColorAttributeName,
                                            [UIFont fontWithName:@"TitilliumText22L-Medium" size:22.0], NSFontAttributeName,
                                            nil] ];
    UINavigationItem *navigationItem = [[UINavigationItem alloc] initWithTitle:@"TEST SSS"];
    UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 30)];
    [button setImage:[UIImage imageNamed:@"menu_back.png"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *buttonItemA = [[UIBarButtonItem alloc] initWithCustomView:button];
    navigationItem.leftBarButtonItem = buttonItemA;
    UIButton *buttonA = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 88, 30)];
    [buttonA setImage:[UIImage imageNamed:@"sss.png"] forState:UIControlStateNormal];
    UIBarButtonItem *buttonItemB = [[UIBarButtonItem alloc] initWithCustomView:buttonA];
    navigationItem.rightBarButtonItem = buttonItemB;
    [navigationBar pushNavigationItem:navigationItem animated:NO];
}
- (UIStatusBarStyle) preferredStatusBarStyle {
    return UIStatusBarStyleLightContent;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)buttonClicked:(id)sender {
    NSLog(@"ssd finish");
    [self.navigationController popViewControllerAnimated:YES|NO];
}
@end
 
    