iphone - 在 iPhone App 首次启动时显示信息 imageview

标签 iphone ios ipad uiimageview app-startup

<分区>

我想知道如何向应用程序添加一张图像,该图像覆盖整个屏幕并包含有关应用程序本身的信息。

这是要求:

  • 只在第一次启动时显示一次
  • 覆盖整个屏幕(包括标签栏和导航栏)
  • 当用户点击图片时,它应该消失并且不会再出现 ;)

示例(只在 iPad 上找到一个,虽然我需要它用于 iPhone):

enter image description here

我该怎么做?有没有我可以使用的免费框架?非常感谢任何提示、信息或链接。

最佳答案

  1. 检查 NSUserDefaults 之前是否显示(和关闭)帮助 View
  2. 创建 UIImageView 并将其添加到您的 View
  3. 将 UITapGestureRecognizer 添加到 imageView
  4. 在点击手势的操作中删除帮助 View 并将 View 已关闭的信息保存到 NSUserDefaults。

.

- (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"];
}

关于iphone - 在 iPhone App 首次启动时显示信息 imageview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14797253/

相关文章:

iphone - 如何以编程方式打开调出 MKAnnotationView? (iPhone, MapKit)

iphone - iOS - backbarButtonItem : Canceling back?

c - Xcode 导航栏按钮崩溃

ios - 使用 shouldPerformSegueWithIdentifier 时,必须点击按钮两次才能进入下一个 View

iphone - iOS写入文件

ios - 隐藏 iPad 上的键盘?

css - 调整 iPad 背景图片大小

iPhone 应用程序本地化 - 英语问题?

iphone - iPhone SDK 中的数学库?

iphone - 画圆UIButton性能