启动iOS应用程序时,屏幕将从Default.png跳入界面。对于当前项目,我想从该Default.png淡入应用程序的界面。有什么好方法吗?

最佳答案

我做了一些rooster117和runmad的回答,这就是我想出的。

将UIImageView添加到第一个UIViewController的属性中:

@interface DDViewController : UIViewController {
   ...
    UIImageView *coverImageView;
}

...

@property (nonatomic, retain) UIImageView *coverImageView;

然后,对于iPad应用程序的“主屏幕”,我调用以下命令:
- (void)viewDidLoad
{
    [super viewDidLoad];

    ...

    coverImageView = [[UIImageView alloc] init];
}

-(void)viewWillAppear:(BOOL)animated {
    UIImage *defaultImage;
    if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) {
        NSLog(@"Landscape!");
        defaultImage = [UIImage imageNamed:@"Default-Landscape.png"];
    } else {
        NSLog(@"Portrait!");
        defaultImage = [UIImage imageNamed:@"Default-Portrait.png"];
    }

    coverImageView = [[UIImageView alloc] initWithImage:defaultImage];
    [self.view addSubview:coverImageView];

}

-(void)viewDidAppear:(BOOL)animated {
    //Remove the coverview with an animation
    [UIView animateWithDuration:1.0f animations:^(void) {
        [self.coverImageView setAlpha:0.0];
    } completion:^(BOOL finished){
        [coverImageView removeFromSuperview];
    }];
}

10-08 06:26