Show image presentation information when first launching iPhone app

I am wondering how I can add an image to the application that overlays the entire screen on information about the application itself.

These are the following requirements:

  • Show only once on first launch
  • Full screen cover (including bar and navigation bar)
  • When the user clicks on the image, it should fade out and not reappear;)

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

enter image description here

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

+3


source to share


2 answers


  • Check NSUserDefaults if help submission (and rejected) before
  • Create UIImageView and add it to your view
  • Add UITapGestureRecognizer to imageView
  • in the gesture action, tap removes the help view and stores in NSUserDefaults that the view was rejected.

...



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

      

+6


source


Define some BOOL key in NSUserDefaults. If it is NO, show your overlay and set it to YES. The next time the user launches the application, this step will be skipped.

To add an image to view your view, the code would look something like this:



UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.frame];
imageView.image = [UIImage imageNamed:@"overlay image"];
[self.view addSubview:imageView];

      

+3


source







All Articles