performSegueWithIdentifier:发送者:强制退出后不工作(iOS)

时间:2013-09-20 13:14:48

标签: iphone ios objective-c xcode ipad

我有一个应用程序,一切正常。但是,当我强制退出应用程序(多任务 - >退出应用程序)时,重启无法正常工作。每当我按下按钮时,它都会显示下一个视图,但performSegueWithIdentifier:sender:没有被执行(因为NSLog没有显示)。

这是一个问题,因为我使用prepareForSegue:sender:发送了信息。因此,如果没有这些方法,应用程序将无法正常工作。

我测试了它:

模拟器:

  • 3,5和4英寸
  • iOS 6和7

iPhone:

  • iPhone 4,4S和5
  • iOS 6和7

ipad公司:

  • iPad 2
  • iOS 6和7

修改

好的,所以代码如下。

// Gets executed when the user presses the button
- (IBAction)loginButton:(UIButton *)sender {
    [self performSegueWithIdentifier:@"MyModalViewSegue" sender:sender];
}

// This will get called too before the view appears
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"MyModalViewSegue"]) {
        // Get destination view
        ModalViewController *vc = [segue destinationViewController];

        // Set the delegate and password mode
        vc.mode = @"triple";
    }
}

0 个答案:

没有答案