Reputation: 502
I have made a helper class for MFMessageComposeViewController
so instead of view controller I have made my class with MFMessageComposeViewController as base class.
Now I am trying to present this Controller from my another controller named "ViewController B" on a button action. I am trying to pass the value from this controller to messageBody
variable of MessageSSCont.h
. The button action is like this :
self.messageController = [[MessageSSCont alloc]init];
self.messageController.messageBody = @"jfhjkhasfjhkwhfhdfjkjkfbhiehf";
[self presentViewController:self.messageController animated:YES completion:nil];
But unfortunately when the MFMessageComposeViewController is presented the value of messageBody
is null. Where I am doing wrong in this scenario. Why my variable is not getting passed to the MessageCont.h
class?
Upvotes: 0
Views: 78
Reputation: 77690
OK - you have subclassed MFMessageComposeViewController
, so you have its properties / methods available to your class.
You don't need these in your .h
file:
//@property (strong, nonatomic) NSString *messageBody;
//@property (strong, nonatomic) NSString *receivingNumber;
You can call your custom MFMessageComposeViewController
like this:
self.messageController = [[MessageControllerKony alloc]init];
//self.messageController.messageBody = @"jfhjkhasfjhkwhfhdfjkjkfbhiehf";
[self.messageController setBody:@"jfhjkhasfjhkwhfhdfjkjkfbhiehf"];
[self.messageController setRecipients:[NSArray arrayWithObject: @"13123123"]];
[self presentViewController:self.messageController animated:YES completion:nil];
Upvotes: 1