【问题标题】:When trying to segue, nothing happens尝试转场时,什么也没有发生
【发布时间】:2013-10-02 03:06:47
【问题描述】:

我有一个正在开发的应用程序,我正在尝试让徽标显示更长时间,并在完成后淡出/滑出/效果。

这是我的设置:

Tab Bar 控制器不允许我在其中放置图像视图,因此我创建了一个视图以将其打开。

我正在尝试让徽标保持一段时间,然后淡出,然后自动将视图(Segue)切换到 Tab Bar 控制器。

这就是我从中得到的:http://youtu.be/l4jL0BfpR2k

这是我的代码:

//
//  BDNLogoViewController.m
//  Bronydom Network
//
//  Created by name on 10/1/13.
//  Copyright (c) 2013 name. All rights reserved.
//

#import "BDNLogoViewController.h"
#import "BDNTabBarController.h"
#import "BDNFirstViewController.h"

@interface BDNLogoViewController ()

@end

@implementation BDNLogoViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}



- (void)viewDidLoad
{
    [super viewDidLoad];

    // Do any additional setup after loading the view.
    [UIView animateWithDuration:1 animations:^{
        _imageview.alpha = 0;
    }];

    //BDNTabBarController *viewController = [[BDNTabBarController alloc] init];
    //[self.navigationController pushViewController:viewController animated:YES];

    (void)@selector(seguePerform:);

}

- (void)seguePerform:(id)sender
{
    //BDNTabBarController *myNewVC = [[BDNTabBarController alloc] init];

    // do any setup you need for myNewVC

[self performSegueWithIdentifier:@"open" sender:sender];
}

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

@end

是的,“open”被定义为segue id。

你们对我如何解决这个问题有什么想法吗?

【问题讨论】:

    标签: ios objective-c segue


    【解决方案1】:

    要修复,添加这个

    - (void) viewDidAppear:(BOOL)animated
    {
        [super viewDidAppear:YES];
        [self performSegueWithIdentifier:@"open" sender:self];
    }
    

    从您的代码中删除它

    (void)@selector(seguePerform:); // 以及所有其他不必要的 segue 内容

    【讨论】:

    • 第一个图像消失了,因为我正在为图像的 Alpha 设置动画。哦,我试图登录 prepareForSegue 部分,但我从未收到消息。还有什么想法吗?
    • 显然没有调用“prepareforSegue”方法或 Segue [self performSegueWithIdentifier:@"open" sender:sender]; 不起作用。
    • 看起来我有正确的(主要),我在 Segue Identifier 框中也有“open”。
    • 上传代码到dropbox什么的,我看看,也可以在目标VC的viewDidLoad中放一个日志。还可以阅读此stackoverflow.com/questions/8838160/…
    猜你喜欢
    • 2021-10-02
    • 2012-09-14
    • 1970-01-01
    • 2014-08-30
    • 1970-01-01
    • 2012-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多