Bold360 and BoldChat Developer Center

Presenting BoldChatViewController from Storyboard

If the view settings contains the following styles, the view controller can be presented without an embedding navigation controller:

Steps to add without navigation controller

  1. Add a view controller to the storyboard.

  2. Set the custom class of the view controller to BoldChatViewController.

  3. Add a segue from the presenter view controller to the BoldChatViewController
  4. Add the following lines to the view controller code, that handles the segue:

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
        if ([segue.identifier isEqualToString:@"<name of the segue displaying the navigation controller>"]) {
            BCAccount *account= [BCAccount accountWithAccessKey:@"<access key from web setup>"];
            BoldChatAccountSettings *accountSettings = [[BoldChatAccountSettings alloc] init];
            accountSettings.account = account;
            accountSettings.visitorId = <customer id to track the user>;
            
            BoldChatViewSettings *viewSettings = [[BoldChatViewSettings alloc] init];
            viewSettings.formSubmitStyle = BoldChatViewSettingsFormSubmitStyleLastCell;
    		viewSettings.endChatStyle = BoldChatViewSettingsEndChatStyleOnChatView;
            
            BoldChatViewController *bvc = (BoldChatViewController *)segue.destinationViewController;
            [bvc configureWithAccountSettings:accountSettings viewSettings:viewSettings language:nil];
        }
    }
    

  5. Start the chat

    [bvc start];

Steps to add with navigation controller

  1. Add a navigation controller to the storyboard

  2. Add a view controller to the storyboard
  3. Set the custom class of the view controller to BoldChatViewController

  4. Add a "root view" relationship segue from the navigation controller to the BoldChatViewController
  5. Add a segue from the presenter view controller to the navigation controller
  6. Add the following lines to the view controller code, that handles the segue:

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
        if ([segue.identifier isEqualToString:@"<name of the segue displaying the navigation controller>"]) {
            BCAccount *account= [BCAccount accountWithAccessKey:@"<access key from web setup>"];
            BoldChatAccountSettings *accountSettings = [[BoldChatAccountSettings alloc] init];
            accountSettings.account = account;
            accountSettings.visitorId = <customer id to track the user>;
            
            BoldChatViewSettings *viewSettings = [[BoldChatViewSettings alloc] init];
            UINavigationController *navc = (UINavigationController *)segue.destinationViewController;
            BoldChatViewController *bvc = [navc viewControllers][0];
            [bvc configureWithAccountSettings:accountSettings viewSettings:viewSettings language:nil];
        }
    }
    

  7. Start the chat

    [bvc start];