我在想如何将图像添加到应用程序,该应用程序覆盖了整个屏幕与应用程序本身的信息。在第一次启动iPhone应用程序时显示信息imageview
这是要求:
- 只有在第一次启动
- 覆盖整个屏幕显示一次(包括的TabBar和导航栏)
- 当图像用户点击,就应该消失,并不会出现再次;)
例(只发现一个在iPad上,但我需要它为iPhone):
我该怎么做?有没有我可以使用的免费框架?任何提示,信息或链接非常感谢。
我在想如何将图像添加到应用程序,该应用程序覆盖了整个屏幕与应用程序本身的信息。在第一次启动iPhone应用程序时显示信息imageview
这是要求:
例(只发现一个在iPad上,但我需要它为iPhone):
我该怎么做?有没有我可以使用的免费框架?任何提示,信息或链接非常感谢。
。
- (void)viewDidLoad {
[super viewDidLoad];
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"didDisplayHelpScreen"]) {
UIWindow *window = [[[UIApplication sharedApplication] windows] lastObject];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:window.bounds];
imageView.image = [UIImage imageNamed:@"78-stopwatch"];
imageView.backgroundColor = [UIColor greenColor];
imageView.alpha = 0.5;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissHelpView:)];
[imageView addGestureRecognizer:tapGesture];
imageView.userInteractionEnabled = YES;
[window addSubview:imageView];
}
}
- (void)dismissHelpView:(UITapGestureRecognizer *)sender {
UIView *helpImageView = sender.view;
[helpImageView removeFromSuperview];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"didDisplayHelpScreen"];
}
在NSUserDefaults中定义一些BOOL键。如果不是,则显示您的覆盖图并将其设置为YES。下次用户启动应用程序时,此步骤将被跳过。
要添加图像来覆盖你的观点,代码将是这个样子:
UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.frame];
imageView.image = [UIImage imageNamed:@"overlay image"];
[self.view addSubview:imageView];
好提示,thx。在整个屏幕上设置UIImageView怎么样? – doonot 2013-02-10 11:34:54
@ H2CO3,如果仔细阅读,它不是真的重复! – doonot 2013-02-10 11:38:35
事实上,这不是重复的。 – Koen 2016-04-24 20:36:45