Presenting BoldChatViewController from Storyboard
If the view settings contains the following styles, the view controller can be presented without an embedding navigation controller:
- formSubmitStyle = BoldChatViewSettingsFormSubmitStyleLastCell
- endChatStyle = BoldChatViewSettingsEndChatStyleOnChatView
Steps to add without navigation controller
-
Add a view controller to the storyboard.
-
Set the custom class of the view controller to
BoldChatViewController.
- Add a segue from the presenter view controller to the BoldChatViewController
-
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]; } }
-
Start the chat
[bvc start];
Steps to add with navigation controller
-
Add a navigation controller to the storyboard
- Add a view controller to the storyboard
-
Set the custom class of the view controller to
BoldChatViewController
- Add a "root view" relationship segue from the navigation controller to the BoldChatViewController
- Add a segue from the presenter view controller to the navigation controller
-
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]; } }
-
Start the chat
[bvc start];