简体   繁体   English

iPhone:实用程序应用程序-启动时打开Flipside

[英]iPhone: Utility Application - Open Flipside on startup

I have an application that I started with the Utility Application template. 我有一个以Utility Application模板启动的应用程序。 I'm using the Flipside for the Settings screen. 我将Flipside用于“设置”屏幕。 I'm having the settings serialized to a file when the app is closed and deserialized when the app is opened. 我在关闭应用程序时将设置序列化为文件,在打开应用程序时将其反序列化。 If there is no file to deserialize at startup, I want the flipside to be shown so the user can enter required information. 如果在启动时没有要反序列化的文件,我希望显示反面,以便用户可以输入所需的信息。

This is what I have: 这就是我所拥有的:

- (void)viewDidLoad
{
    flipController = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
    flipController.delegate = self;
    flipController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

    if(![self deserialize])
    {
        [self showInfo];
    }
}

- (IBAction)showInfo
{       
    [self presentModalViewController:flipController animated:YES]; 
}

showInfo is the method that is called with the little 'i' button is pressed on the MainView. showInfo是在MainView上按下小“ i”按钮调用的方法。 The button works, however my call in viewDidLoad doesn't. 该按钮有效,但是我在viewDidLoad中的调用无效。

I have run through my code with the debugger. 我已经用调试器运行了我的代码。 [self deserialize] is returning NO and [self showInfo] is being called, and I checked if flipController is nil in that context, and it's not. [self deserialize]返回NO并调用[self showInfo] ,我检查了在这种情况下flipController是否为nil ,否。

I've searched around and couldn't find anyone who's tried to do the same thing. 我到处搜寻,找不到试图做同样事情的人。 I'm stumped to as why this isn't working. 我很困惑为什么这不起作用。 Anyone see what I'm doing wrong? 有人看到我在做什么错吗?

Thanks 谢谢

您可能想要尝试将-showInfo调用移至-viewDidAppear:方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM