Methods 输入方法,但不显示任何内容

Methods 输入方法,但不显示任何内容,methods,call,viewcontroller,appdelegate,Methods,Call,Viewcontroller,Appdelegate,我试图调用ViewController类表单AppDelegate的一个方法,它进入该方法,但问题是没有显示任何内容,我一直在寻找,但我找不到答案。有人能帮我吗?谢谢 代码如下: AppDelegate.m - (void)applicationWillEnterForeground:(UIApplication *)application { if (mainDelegate.isflagON=TRUE) { ViewController *vc=[View

我试图调用ViewController类表单AppDelegate的一个方法,它进入该方法,但问题是没有显示任何内容,我一直在寻找,但我找不到答案。有人能帮我吗?谢谢

代码如下:

AppDelegate.m

- (void)applicationWillEnterForeground:(UIApplication *)application
{

    if (mainDelegate.isflagON=TRUE)
    {

        ViewController *vc=[ViewController new];
        [vc pause];

    }

}
ViewController.m

- (void)viewDidLoad
{

    [super viewDidLoad];
    AppDelegate *mainDelegate = [[UIApplication sharedApplication] delegate];
    if (mainDelegate.isflagON==false)
    {
        mainDelegate.isflagON=true;
        CGSize viewSize = self.view.bounds.size;
        // Add this line

        GameScene *scene = [[GameScene alloc] initWithSize:viewSize];
        scene.scaleMode = SKSceneScaleModeAspectFill;
        self.scene = scene;

        // Configure the view.
        skView = (SKView *)self.view;
        skView.showsFPS = YES;
        skView.showsNodeCount = YES;


        // Present the scene.
        [skView presentScene:scene];

    }else
    {
        [self doPause];
    }
}

-(void) imprime
{
    [self doPause];

}

- (void)doPause {

    CGRect myImageRect = CGRectMake(0.0f, 0.0f, 200.0f, 200.0f);
    backImageView = [[UIImageView alloc] initWithFrame:myImageRect];
    [backImageView setImage:[UIImage imageNamed:@"dialogBox.png"]];
    [self.view addSubview:backImageView];
    [self.view sendSubviewToBack:backImageView];

    //set the position of the button

    buttonContinuar = [UIButton buttonWithType:UIButtonTypeCustom];

    [buttonContinuar setBackgroundImage:[UIImage imageNamed:@"dialogButton.png"]
                               forState:UIControlStateNormal];
    buttonContinuar.frame = CGRectMake(40.0f, 50.0f, 120, 35);
    [buttonContinuar addTarget:self action:@selector(buttonWasClicked:) forControlEvents:UIControlEventTouchUpInside];
    [buttonContinuar setTitle:@"Continuar" forState:UIControlStateNormal];
    //add the button to the view
    [self.view addSubview:buttonContinuar];

    buttonMapa = [UIButton buttonWithType:UIButtonTypeCustom];
    //[button setTitle:@"Continuar" forState:UIControlStateNormal];

    [buttonMapa setBackgroundImage:[UIImage imageNamed:@"dialogButton.png"]
                          forState:UIControlStateNormal];
    buttonMapa.frame = CGRectMake(40.0f, 85.0f, 120, 35);
    [buttonMapa addTarget:self action:@selector(buttonMapaClicked:) forControlEvents:UIControlEventTouchUpInside];
    [buttonMapa setTitle:@"Mapa" forState:UIControlStateNormal];
    //add the button to the view
    [self.view addSubview:buttonMapa];

    buttonMenu = [UIButton buttonWithType:UIButtonTypeCustom];
    //[button setTitle:@"Continuar" forState:UIControlStateNormal];

    [buttonMenu setBackgroundImage:[UIImage imageNamed:@"dialogButton.png"]
                          forState:UIControlStateNormal];
    buttonMenu.frame = CGRectMake(40.0f, 120.0f, 120, 35);
    [buttonMenu addTarget:self action:@selector(buttonMenuClicked:) forControlEvents:UIControlEventTouchUpInside];
    [buttonMenu setTitle:@"Menu" forState:UIControlStateNormal];
    //add the button to the view
    [self.view addSubview:buttonMenu];

}
你可以试试这个

- (void)applicationWillEnterForeground:(UIApplication *)application
{

    if (mainDelegate.isflagON=TRUE)
    {

        ViewController *vc=[[ViewController alloc]init];
        [vc pause];

    }

}

您的代码是一个巨大的格式混乱,所以我还没有深入了解,但我可以告诉您,第一行包含一个错误。您正在使用赋值运算符,而您应该使用相等运算符。换句话说,
if(maindegate.isflagON=TRUE)
应该是
if(maindegate.isflagON==TRUE)
此外,在Objective-C中,您应该使用YES/NO而不是TRUE/false,在第二行中,您不应该执行“ViewController*vc=[ViewController new]”,而是执行[[ViewController alloc]init]。