Search code examples
iphoneiosipaduiimageviewapp-startup

Show information imageview on first startup of iPhone App


I am wondering how I can add an image to the app that overlays the whole screen with information about the app itself.

This are the requirements:

  • Only show once on first start
  • Cover the whole screen (including tabbar and navigationbar)
  • When user clicks on image, it should fade away and never appear again ;)

Example (Only found one on iPad, although I need it for the iPhone):

enter image description here

How can I do this? Are there any free frameworks I can use? Any hints, information or links are much appreciated.


Solution

    1. Check NSUserDefaults if the help view was displayed (and dismissed) before
    2. Create UIImageView and add it to your view
    3. Add UITapGestureRecognizer to the imageView
    4. in the action of the tap gesture remove the help view and save to NSUserDefaults that the view was dismissed.

    .

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