iPhone:实用程序应用程序 - 启动时打开 Flipside
我有一个使用实用程序应用程序模板启动的应用程序。 我使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想尝试将 -showInfo 调用移至 -viewDidAppear: 方法。
You might want to try moving your -showInfo call to your -viewDidAppear: method.