我的应用程序出现问题,.i在我的mainviewcontroller viewdidload方法中使用此代码来检查首次启动应用程序的天气
NSUserDefaults *padFactoids;
int launchCount;
padFactoids = [NSUserDefaults standardUserDefaults];
launchCount = [padFactoids integerForKey:@"launchCount" ] + 1;
[padFactoids setInteger:launchCount forKey:@"launchCount"];
[padFactoids synchronize];
NSLog(@"number of times: %i this app has been launched", launchCount);
if ( launchCount == 1 )
{
NSLog(@"this is the FIRST LAUNCH of the myBibleapp");
// do stuff here as you wish
UIScrollView_PagingViewController *detailViewController = [[UIScrollView_PagingViewController alloc] initWithNibName:@"UIScrollView_PagingViewController" bundle:nil];
//detailViewController.firstString = firstString;
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
if ( launchCount == 2 )
{
// do stuff here as you wish
NSLog(@"this is the SECOND launch of the myBibleapp");
// do stuff here as you wish
}
如果应用程序第一次启动它将进入UIScrollView_PagingViewController页面,或者保留在mainviewcontroller中,我的问题是我需要取消隐藏主控制器中的刻度图像以统计某些条件,当第一次启动应用程序时men. {men} tickimage.hidden = NO;
,我把它放在第一个条件下,但我没有从代码中取消任何内容。如何做到这一点。
提前谢谢。
答案 0 :(得分:1)
首先,您需要学习如何在XCode中使用断点和调试技术。我建议你先去看看......
...已经回来了?好。我希望你现在明白这些概念。这是你需要做的事情
padFactoids = [NSUserDefaults standardUserDefaults];
padFactoids
和launchCount
。padFactoids
是有效对象吗? launchCount是您期望的值吗?