0

わかりました、これが最初のページにあるすべてです

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

ビューを2ページ目に遷移させるボタンを取得して、3ページ目の件名に同時にテキストを割り当てようとしています。そこにある件名にテキストを取得する方法は知っていますが、そこにテキストを取得する方法はわかりません。

初心者で分かりにくくてすみません。

4

1 に答える 1

0

コードを見ずに答えるのは難しいですが、試してみます。

ソフトウェア設計の観点から、「3 番目のページ」が 1 番目または 2 番目のページに依存しないことが重要です。その結果、2 番目のページをプッシュするときに、最初のページから必要な情報を提供します。例えば:

最初のページ コード (最小の Ma​​c ではなく、疑似コード):

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

次に、2 番目のページで、3 番目のページに移動するときに:

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

このようにして、各コントローラーは、その仕事を行うために何を知る必要があるかを認識します。3 番目のコントローラーは、1 番目または 2 番目のコントローラーに依存したり、知ったりする必要はありません。それを作成したもの、そのsubjectLineプロパティを初期化したもの (およびその他に必要なもの) だけです。

于 2013-11-01T01:39:41.137 に答える