Wednesday, 28 August 2013

Why isn't my data not being passed through view controllers?

Why isn't my data not being passed through view controllers?

I am trying to pass textfield text from one controller to another
controller so I can email it. I am following an example, but I must be
missing some little details. Basically the goal is to pass data textfield
text from enteryournamecontroller controller to option controller's
nsstring. The nsstring's string variable is being returned null.
EnterYourNameController.h
@interface EnterYourNameController : UIViewController{
UITextField *textField;
id <EnterYourNameController> delegate;
}
@property (strong, nonatomic) NSString *stringEntered;
@property (strong, nonatomic) UITextField *textField;
@property (strong, nonatomic) id delegate;
EnterYourNameController.m
-(void)button{
stringEntered=textField.text;
((Options *) (self.delegate)).string = stringEntered;
}
options.h
@interface Options : UIViewController
<MFMailComposeViewControllerDelegate> {
NSString *string;
}
@property (strong,nonatomic) NSString* string;
@end
option.m
NSString *emailBody = [NSString stringWithFormat:@"%@",string];

No comments:

Post a Comment