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

发布于 2024-08-26 20:35:20 字数 932 浏览 8 评论 0原文

我有一个使用实用程序应用程序模板启动的应用程序。 我使用 Flipside 作为设置屏幕。当应用程序关闭时,我将设置序列化为文件,并在应用程序打开时将设置反序列化。如果启动时没有要反序列化的文件,我希望显示另一面,以便用户可以输入所需的信息。

这就是我所拥有的:

- (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 是在 MainView 上按下小“i”按钮时调用的方法。该按钮可以工作,但是我在 viewDidLoad 中的调用却不起作用。

我已经使用调试器运行了我的代码。 [self deserialize] 返回 NO 且正在调用 [self showInfo],并且我检查了 flipController 是否为在这种情况下nil,但事实并非如此。

我环顾四周,找不到任何人尝试做同样的事情。我很困惑为什么这不起作用。有人看到我做错了什么吗?

谢谢

I have an application that I started with the Utility Application template.
I'm using the Flipside for the Settings screen. 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. The button works, however my call in viewDidLoad doesn't.

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.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

獨角戲 2024-09-02 20:35:20

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

You might want to try moving your -showInfo call to your -viewDidAppear: method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文