Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jjanes

macrumors newbie
Original poster
Feb 28, 2011
9
0
OK I am building my first IPAD App I have been programming in the past but am fairly new to object oriented processes and getting confused here.
In my viewcontroller.m file I have several objects and actions (what I used to call functions)

i have one that is a textbox and I want to get the value of what is in the text box when I go into the action code I can manipulate it and send it to the log etc. and this is what I expect and what I used to do in the non OOP functions.

Here is my confusion in the OOP functions unless my variables were designated as global once I left the function they were gone.

That is what seems to be happening in my App code as well

I want to grab the content of the text box and then let the MFMailComposeViewController use that content to add it to the body of the email or elsewhere as is needed

How do I set the content of that textbox so that MFMailComposeViewController can see and use it

An example:
A textbox object called name
A new variable I was trying to use as a holder to go between the two areas
called outName it has these settings in my .h file

Code:
@property (weak, nonatomic) IBOutlet UITextField *outName;

and in my .m file it is synthesized and released

the controller named MFMailComposeViewController has a variable called emailBody inside of it.

Now aside from joining several of the answerXXXX variables together to make the actual body of the email the way it will eventually.

HOW would I get just that single variable outName to be available to MFMailComposeViewController so I can set emailBody equal to it



in the MFMailComposeViewController emailBody is set like this
Code:
NSString *emailBody  = [NSString stringWithFormat:@"Full Name: %@",outName];

in the IBAction for this variable the code is set like this
Code:
- (IBAction)answerName:(id)sender {
    NSLog(@"Name");
    NSLog([NSString stringWithFormat:@"%@", name.text]);
    [outName setText:name.text];
    
    [name resignFirstResponder];
}
Currently all are coming back null when the email is actually shown however in the log they are set and show correctly

How is this done normally

Thanks
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.