[Xcode]アプリ起動時のフェードアウトアニメーションなど

アプリ起動時に、適度にDefault画面を表示して、適度なフェードアウトでアプリ画面に移動すると、よさそう。

古めの内容です。

Defaultスクリーンを、起動時確実に表示

sleepForTimeIntervalで止めてしまおう。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [NSThread sleepForTimeInterval:1.0];
...
...
    [self splashAnimation];
    return YES;
}

スプラッシュアニメーション

これは単なるフェードアウト。

- (void)splashAnimation{
    UIImage *img=nil;
    if(g_is4inch){
        img= [UIImage imageNamed:@"Default-568h.png"];
    }else{
        img= [UIImage imageNamed:@"Default.png"];
    }
    UIImageView *imageview =
    [[[UIImageView alloc] initWithImage:img] autorelease];
    imageview.contentMode = UIViewContentModeScaleAspectFit;
    imageview.frame = self.window.frame;
    [self.window addSubview:imageview];
    
    [UIView animateWithDuration:1.5
                     animations:^{
                         //アニメーション操作
                         imageview.alpha = 0.0;
                     }
                     completion:^(BOOL finished){
                         //アニメーション終了時操作
                         [imageview removeFromSuperview];
                     }];
}

自分のアプリでは、あんまり考えてなかったのだけど^^;

人に見せるのを作っていたら、あったほうがいいなーと試してみてた。
そのうち実装も考えよう。

g_is4inchは、4インチ画面の判別です。
→→ [Xcode]iPhone5の4インチ縦長画面に対応するには

(追記)
Images.xcassetsを利用する場合は、フォルダ名(LaunchImage)で中の画像を取得できます。

    if(g_is4inch){
        img= [UIImage imageNamed:@"LaunchImage-568h@2x.png"];
    }else{
        img= [UIImage imageNamed:@"LaunchImage@2x.png"];
    }