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

我试图获取将视图转换到第二页的按钮,以同时将文本分配给第三页上的主题行。我知道如何在主题中获取文本,但我不知道如何获取文本。

我很抱歉不清楚这我是初学者。

4

1 回答 1

0

没有看到一些代码很难回答,但我会试一试。

从软件设计的角度来看,您的“第三页”不要依赖第一页或第二页,这一点很重要。因此,当您推送第二页时,您向它提供了第一页所需的信息。例如:

第一页代码(伪代码,不在 Mac 上):

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

然后在您的第二页上,当移动到第三页时:

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

这样每个控制器都知道它需要知道什么来完成它的工作。第三个控制器不依赖,也不需要知道任何关于第一个或第二个控制器的信息,只知道创建它的任何东西,初始化它的subjectLine属性(加上其他需要的东西)。

于 2013-11-01T01:39:41.137 回答