开发者

CATransition in AppDelegate - didFinishLaunchingWithOptions

I've imple开发者_如何学运维mented this code in another app, and it worked great. Now, the same code is not working here (I am importing QuartzCore framewok)... The log message IS called. Could anyone help me please? Thanks in advance. This is my code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.
    [NSThread sleepForTimeInterval:1.5];

    CATransition *transition = [CATransition animation];
    transition.delegate = self;
    transition.duration = 1.5;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionFade;

    [[window layer] addAnimation:transition forKey:nil];

    [window addSubview:[navigationController view]];
    [window makeKeyAndVisible];

    return YES;
}

- (void)animationDidStop:(CAAnimation *)theAnimation finished: (BOOL)flag
{
    NSLog(@"Animation did stop!");
}


Move:

    [[window layer] addAnimation:transition forKey:nil];

below:

    [window makeKeyAndVisible];

You're explicitly creating the animation, but you're applying the animation "Before" you want to add the Subview to the Window. By placing it below, you tell the Window that you want to animate the positioning of the subview.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜