RRMessageController

:iphone::memo: RRMessageController is a UIViewController, allows you to write a message with photos as attachment.

219
25
Objective-C

RRMessageController


Version
License
Platform

RRMessageController is a UIViewController, allows you to write a message with photos as attachment.
A messages UI for iPhone. Support text && image. Works with all custom Keyboard for iOS 8.



Installation

RRMessageController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "RRMessageController"

RRMessageController needs AVFoundation Framework

Usage


With block :

```Objective-C - (void) newMessage { RRSendMessageViewController *controller = [[RRSendMessageViewController alloc] init];
[controller presentController:self blockCompletion:^(RRMessageModel *model, BOOL isCancel) {
    if (isCancel == true) {
        self.message.text = @"";
    }
    else {
        self.message.text = model.text;
    }
    [controller dismissViewControllerAnimated:YES completion:nil];
}];

}

<hr>
<p align="center">With delegate :</p>

```Objective-C
#pragma mark RRSendMessageController Delegate

- (void) messageCancel {
    [self.controllerMessage dismissViewControllerAnimated:YES completion:nil];
}

- (void) getMessage:(RRMessageModel *)message {
    self.message.text = message.text;
    [self.controllerMessage dismissViewControllerAnimated:YES completion:nil];
}

- (void) newMessage {
    [self presentViewController:self.controllerMessage animated:YES completion:nil];
}

- (void) initMessageController {
    self.controllerMessage = [[RRSendMessageViewController alloc] init];
    self.controllerMessage.delegate = self;
}

You can launch a RRSendMessgeController with a existant message:

RRMessageModel *defaultMessage = [[RRMessageModel alloc] init];
defaultMessage.text = @"salut !";
defaultMessage.photos = [self getRandomPhotos];
    
RRSendMessageViewController *controller = [[RRSendMessageViewController alloc] initWithMessage:defaultMessage];