loganwright / SimpleChat

An Easy To Use Bubble Chat Interface
Mozilla Public License 2.0
262 stars 53 forks source link

It's only supporting in navigation controller? #21

Closed erhuabushuo closed 9 years ago

erhuabushuo commented 9 years ago

It's only supporting in navigation controller?

loganwright commented 9 years ago

Hi @erhuabushuo

You could theoretically create your own top bar, but at the moment, SimpleChat is designed to be used with a navigation controller. If you want to present it modally, you could do something like this:

LGChatController *chatController = [LGChatController new];
chatController.opponentImage = [UIImage imageNamed:@"<#YourImageName#>"];
chatController.title = @"<#YourTitle#>";
LGChatMessage *helloWorld = [[LGChatMessage alloc] initWithContent:@"Hello World" sentByString:[LGChatMessage SentByUserString]];
chatController.messages = @[helloWorld]; // Pass your messages here.
chatController.delegate = self;

// Put chat controller in a navigation controller here
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:chatController];
[self presentViewController:nav withCompletion:nil];

Does this help resolve your issue?

Best,

Logan