Note that there are some explanatory texts on larger screens.

plurals
  1. POUIImageView automatically removing itself from self.view
    primarykey
    data
    text
    <pre><code>tutorialImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Tap to Start.png"]]; tutorialImage.frame = CGRectMake(0, 0, 1024, 768); [tutorialImage addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(blankMethod)]]; tutorialImage.userInteractionEnabled = YES; // i use this line and the previous line so that the user can't press any buttons behind the image tutorialImage.alpha = 0; [self.view addSubview:tutorialImage]; [self.view bringSubviewToFront:tutorialImage]; [UIView animateWithDuration:1.0f animations:^{ tutorialImage.alpha = 1; } completion:^(BOOL finished) { [self.view addSubview:tutorialImage]; // this line makes the image come back }]; </code></pre> <p>I know you probably won't be able to deduce the problem just from this code, but is there anything in that code that makes the tutorialImage auto remove itself from it's superview?</p> <p>Anyway, during the UIView animation the image fades in for a bit like normal, then it disappears. If I add that last line of code there (the commented one), the UIView animation will make the image fade in and flash once halfway through. I just added this image and there is no code telling it to remove itself from superview.</p> <p>Let me know if you have any ideas as to fixing the problem or showing you more code, I'll check frequently.</p> <p>Also, I've tried restarting the simulator which didn't work, and the tutorial image is declared in the h file <code>UIImageView *tutorialImage;</code>. The console doesn't show any errors or anything when the problem occurs or anything.</p> <p>Edit:</p> <p>Ok, strange. I altered the declaration in the H file from <code>UIImageView *tutorialImage;</code> to <code>@property (strong, nonatomic) UIImageView *tutorialImage;</code> then used _tutorialImage fixed the problem. Is this something to do with the strong parameter? I'll mark who ever can explain what was going on as correct.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload