title: How to show log out button on navigation bar's right side to log out from app?
body: <p>How to add the functionality of logging a user out from the app,in form of a button on navigation bar's right side.as there's a navigation button which navigates back to the previous view on the left side of the bar.can there be two buttons on the navigation bar?</p>
  
  <p>the login viewcontroller's code is shown below:</p>
  
  <pre><code>- (IBAction)btnLogin:(id)sender
  {
      NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *docsPath = [paths objectAtIndex:0];
      NSString *path = [docsPath stringByAppendingPathComponent:@"contacts.db"];
      FMDatabase *database = [FMDatabase databaseWithPath:path];
  
      if ([txtUser.text length] == 0 || [txtPass.text length]== 0){
          UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"Kindly enter details in all fields" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
          [alert show];
      }
  
      [database open];
  
      BOOL success = NO;
  
      NSInteger count = [database intForQuery:@"select count(*) from RegMembers where USERNAME = ? and PASSWORD = ?", txtUser.text, txtPass.text];
  
      if (count &gt; 0)
      {
          success = YES;
          appDelegate.username = txtUser.text;
  
          UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Welcome" message:@"Login successful" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
          [alert show];
  
          carTypeViewController *car = [[carTypeViewController alloc]initWithNibName:@"carTypeViewController" bundle:nil];
          [self.navigationController pushViewController:car animated:YES];
      }
      else
      {
          UIAlertView *alert1 = [[UIAlertView alloc]initWithTitle:@"Kindly enter the correct credentials" message:@"Entered username or password is incorrect" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
          [alert1 show];
  
          txtUser.text=@"";
          txtPass.text=@"";
      }
      [database close];
  }
  </code></pre>