Iphone splash screen

I really try my best, but can't figure out what is going on in my code. I did a lot of searching, but I think I just don’t understand some of the objective basics c);

My first question is related to the code below:

[window addSubview:tabBarController.view];

UIImage *image = [UIImage imageNamed:@"lol.png"];
UIImageView *defaultImage = [[UIImageView alloc] initWithImage:image];

Does it make a difference:

[window addSubview:defaultImage];

or that:

[tabBarController.view addSubview:defaultImage];

My second question is about creating a screensaver. I tried to do it myself, but I just can’t figure out what’s not working (we are in appDelegate):

[window addSubview:tabBarController.view];

UIImage *image = [UIImage imageNamed:@"lol.png"];
UIImageView *defaultImage = [[UIImageView alloc] initWithImage:image]; 

[window addSubview:defaultImage];
[window makeKeyAndVisible]; //makes the window visible right ?

UIImage *image2 = [UIImage imageNamed:@"lol2.png"];
UIImageView *pubImage = [[UIImageView alloc] initWithImage:image2];

[UIView setAnimationDelegate:self];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES]; //not sure about the forView:window ...

[defaultImage removeFromSuperview];
[window addSubview:pubImage];

[UIView commitAnimations];

Hmm, I think, as I called "makekeyandvisible" the window should be visible, and the animation should be displayed to users ...

Well, I skipped a step since it does not work: D.

Help greet

Gauthier.

+3
source share
2 answers

"Default.png", .

, , .

any anyways addSubview: , , CATransitions UIView.

.

Edit: - #include <QuartzCore/QuartzCore.h> QuartzCore

// Using a CATransition
    CATransition* transition = [CATransition animation];
    transition.delegate = self; // if you set this, implement the method below
    transition.duration = 0.3;
    transition.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseOut];
    transition.type = kCATransitionMoveIn;
    transition.subtype = kCATransitionFromRight;
    [self.view.layer addAnimation: transition forKey: nil];
    [self.view addSubview: theNewView];

, - , :

#pragma mark -
#pragma mark CAAnimation Delegate Methods
- (void)animationDidStop: (CAAnimation*)theAnimation finished: (BOOL)flag
{
    // Whatever you need to do when the animation is done.
}
+3

, : " " Default.png ", .

Default.png - . Apple HIG .

,

:

  • " ",
  • " "
  • ,

, NSTimer , .

0

Source: https://habr.com/ru/post/1732595/


All Articles