简体   繁体   中英

UIButton -> text from first page to subject line of InAppEmail on third page

Okay here is everything I've got for the first page

roadside.h

#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
#import "SecondView.h"


@interface RoadsideViewController : UIViewController
<MFMailComposeViewControllerDelegate>


{
//here
SecondView *flattireData;
IBOutlet UILabel *flattire;

IBOutlet UIImageView *AnitmationimageView;
IBOutlet UIImageView *Loadimageview;


}

//here
@property (nonatomic, retain) SecondView *flattireData;


- (IBAction)SecondView:(id)sender;

-(void)delay1;
-(void)delay2;
-(void)delay3;

@property (nonatomic, strong) MFMailComposeViewController *myMail;
@end





roadside.m

#import "RoadsideViewController.h"
#import "SecondView.h"
#import "ThirdView.h"


@interface RoadsideViewController ()

@end

@implementation RoadsideViewController
@synthesize myMail;

//here
@synthesize flattireData;



- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

AnitmationimageView.animationImages = [NSArray arrayWithObjects:
                                   [UIImage imageNamed:@"0.png"],
                                   [UIImage imageNamed:@"17.png"],
                                   [UIImage imageNamed:@"34.png"],
                                   [UIImage imageNamed:@"51.png"],
                                   [UIImage imageNamed:@"68.png"],
                                   [UIImage imageNamed:@"85.png"],
                                   [UIImage imageNamed:@"102.png"],
                                   [UIImage imageNamed:@"119.png"],
                                   [UIImage imageNamed:@"136.png"],
                                   [UIImage imageNamed:@"153.png"],
                                   [UIImage imageNamed:@"170.png"],
                                   [UIImage imageNamed:@"187.png"],
                                   [UIImage imageNamed:@"204.png"],
                                   [UIImage imageNamed:@"221.png"],
                                   [UIImage imageNamed:@"238.png"],
                                   [UIImage imageNamed:@"260.png"],
                                   [UIImage imageNamed:@"277.png"],
                                   [UIImage imageNamed:@"294.png"],
                                   [UIImage imageNamed:@"311.png"],
                                   [UIImage imageNamed:@"329.png"],
                                   [UIImage imageNamed:@"346.png"],
                                   [UIImage imageNamed:@"363.png"],
                                   [UIImage imageNamed:@"381.png"],
                                   [UIImage imageNamed:@"398.png"],
                                   [UIImage imageNamed:@"415.png"],
                                   [UIImage imageNamed:@"432.png"],
                                   [UIImage imageNamed:@"450.png"],
                                   [UIImage imageNamed:@"467.png"],
                                   [UIImage imageNamed:@"484.png"],
                                   [UIImage imageNamed:@"502.png"],
                                   [UIImage imageNamed:@"519.png"],
                                   [UIImage imageNamed:@"536.png"],
                                   [UIImage imageNamed:@"554.png"],
                                   [UIImage imageNamed:@"571.png"],
                                   [UIImage imageNamed:@"588.png"],
                                   [UIImage imageNamed:@"605.png"],
                                   [UIImage imageNamed:@"623.png"],
                                   [UIImage imageNamed:@"640.png"],
                                   [UIImage imageNamed:@"x426a.png"],
                                   [UIImage imageNamed:@"x443a.png"],
                                   [UIImage imageNamed:@"x461a.png"],
                                   [UIImage imageNamed:@"x478a.png"],
                                   [UIImage imageNamed:@"x496a.png"],
                                   [UIImage imageNamed:@"x512a.png"],
                                   [UIImage imageNamed:@"x530a.png"],
                                   [UIImage imageNamed:@"x547a.png"],
                                   [UIImage imageNamed:@"x564a.png"],
                                   [UIImage imageNamed:@"x582a.png"],
                                   [UIImage imageNamed:@"x599a.png"],
                                   [UIImage imageNamed:@"x616a.png"],
                                   [UIImage imageNamed:@"x633a.png"],
                                   [UIImage imageNamed:@"x639a.png"],
                                   [UIImage imageNamed:@"x639a.png"],
                                   [UIImage imageNamed:@"x639a.png"],
                                   [UIImage imageNamed:@"x639a.png"],
                                   [UIImage imageNamed:@"x639a.png"],
                                   [UIImage imageNamed:@"x639a.png"],
                                   [UIImage imageNamed:@"x639a.png"],
                                   [UIImage imageNamed:@"x639a.png"],
                                   [UIImage imageNamed:@"x639a.png"],
                                   [UIImage imageNamed:@"x639a.png"],
                                   [UIImage imageNamed:@"x639a.png"],
                                   [UIImage imageNamed:@"x639a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],
                                   [UIImage imageNamed:@"x640a.png"],

                                   nil];
[AnitmationimageView setAnimationRepeatCount:1];
 AnitmationimageView.animationDuration = 2.0;
[AnitmationimageView startAnimating];
[self performSelector:@selector(delay1) withObject:nil afterDelay:2.5];


}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

-(void)delay1 {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
[AnitmationimageView setAlpha:0];
[UIView commitAnimations];
[self performSelector:@selector(delay2) withObject:nil afterDelay:2.0];
}
-(void)delay2 {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[Loadimageview setAlpha:1];
[UIView commitAnimations];
[self performSelector:@selector(delay3) withObject:nil afterDelay:1.5];

}

-(void)delay3 {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[Loadimageview setAlpha:0];
[UIView commitAnimations];
}



- (IBAction)SecondView:(id)sender {
SecondView *second =[[SecondView alloc] initWithNibName:nil bundle:nil];

//here
flattire.text = @"Flat Tire";


self.flattireData = second;
flattireData.flatTire = flattire.text;



[self presentViewController:second animated:YES completion:NULL];
}
@end

Im trying to get the button that transitions the view to the second page to simultaneously assign text to a subject line on the third page. I know how to get the text to the subject once its there but i don't know how to get the text there.

I apologize for not being clear this Im a beginner.

It's hard to answer without seeing some code, but I'll give it a shot.

It's important from a software design point of view for your "third page" to not rely on the first or second. As a result, when you're pushing your second page, you provide it with the information required from the first page. eg:

First page code (pseudo code, not on a mac at the min):

SecondPageController *secondPage = [[SecondPageController alloc]init];
secondPage.subjectLine = @"Flat Tire";
[self PushViewController:secondPage];

Then on your second page, when moving to the third page:

ThirdPageController *thirdPage = [[ThirdPageController alloc] init];
thirdPage.subjectLine = self.subjectLine;
[self PushViewController:thirdPage];

This way each controller knows what it needs to know to do it's job. The third controller doesn't rely, or need to know anything about the first or second controllers, only that whatever created it, initialized its subjectLine property (plus whatever else is needed).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM