Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-09-2011, 10:35 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 53
thehindutimes is on a distinguished road
Default load array in messageBody

I've got an NSMutableArray *order in a view, firstViewController.

And in my secondViewController I'm creating an MFMailComposer where I want to load that array in the messageBody.

How do I reference that array so so that Xcode knows where to get it from?

I've imported firstViewController.h and I'm calling the array like this:


MFMailComposeViewController *orderComposer = [[MFMailComposeViewController alloc] init];
[orderComposer setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
[orderComposer setToRecipients:[NSArray arrayWithObjects:@"E-mail address", nil]];
[orderComposer setSubject:@"Ämne här"];

for(int i=0; i<order; i++){

[orderComposer setMessageBody:[order objectAtIndex:i] isHTML:NO];

}

[orderComposer setModalTransitionStyle:UIModalTransitionStyleCros sDissolve];
[self.tabBarController presentModalViewControllerrderComposer animated:YES];
[orderComposer release];
}
else
[orderComposer release];


But I get an error message saying Use of undeclared identifier 'order'.

Can anyone help?
Thanks!
thehindutimes is offline   Reply With Quote
Old 09-09-2011, 10:56 AM   #2 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 18
glogic is on a distinguished road
Default

Quote:
Originally Posted by thehindutimes View Post
I've got an NSMutableArray *order in a view, firstViewController.

And in my secondViewController I'm creating an MFMailComposer where I want to load that array in the messageBody.

How do I reference that array so so that Xcode knows where to get it from?

I've imported firstViewController.h and I'm calling the array like this:


MFMailComposeViewController *orderComposer = [[MFMailComposeViewController alloc] init];
[orderComposer setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
[orderComposer setToRecipients:[NSArray arrayWithObjects:@"E-mail address", nil]];
[orderComposer setSubject:@"Ämne här"];

for(int i=0; i<order; i++){

[orderComposer setMessageBody:[order objectAtIndex:i] isHTML:NO];

}

[orderComposer setModalTransitionStyle:UIModalTransitionStyleCros sDissolve];
[self.tabBarController presentModalViewControllerrderComposer animated:YES];
[orderComposer release];
}
else
[orderComposer release];


But I get an error message saying Use of undeclared identifier 'order'.

Can anyone help?
Thanks!
You could assign the array "order" to an nsmutablearray in secondviewcontroller. so when u create the second view controller in the first view controller and are about to push it onto the stack you would assign the array like below.

Code:
secondViewController *secondVC = [[secondViewController alloc] init];
   

    secondVC.order = self.order
  
    
    [self.navigationController pushViewController:secondVC animated:YES];
    [secondVC release];
something like that might be what you want
glogic is offline   Reply With Quote
Old 09-09-2011, 11:06 AM   #3 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 53
thehindutimes is on a distinguished road
Default

umm..maybe.

Basically what I need to do is just get the array order in my firstViewController from my secondViewController.

Which should just be firstViewController.order right?

But then I get an error saying property 'order' not found on object of type firstViewController.
thehindutimes is offline   Reply With Quote
Old 09-09-2011, 11:19 AM   #4 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 18
glogic is on a distinguished road
Default

No im afraid it doesnt work like that. Just having the .h of an instance with a file doesnt allow you to see instance variables of that class. Unless you have a pointer to your firstViewController within you second you cant access any of its instance variables. I think the way i said above is the way to do what your looking for. so with secondviewcontroler have an nsmutablearray called order too . and set its @property(nonatomic,retain/assign or whatever you need it to be)nsmutablearray *order. and then @syntezise it in your secondviewcontroller.m to allow you to be able to assign it from firstviewcontroller.m
glogic is offline   Reply With Quote
Old 09-09-2011, 12:07 PM   #5 (permalink)
Registered Member
 
Join Date: Dec 2010
Posts: 2
kolachaitu is on a distinguished road
Default

You could try using a Singleton as discussed here: http://www.iphonedevsdk.com/forum/ip...n-classes.html

since you are sharing data between two views.
kolachaitu is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 413
11 members and 402 guests
apatsufas, Eclectic, fiftysixty, JackReidy, jeroenkeij, Sami Gh, teebee74, tim0504, UMAD, yomo710, yuncarl28
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,672
Threads: 94,121
Posts: 402,904
Top Poster: BrianSlick (7,990)
Welcome to our newest member, yuncarl28
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:00 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0