iphone - 启动应用程序后,如何从 Default.png 淡入?

标签 iphone ios ipad default.png

启动 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];
    }];
}

关于iphone - 启动应用程序后,如何从 Default.png 淡入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11316325/

相关文章:

iphone - 如何验证允许 .仅在文本字段中出现一次

iphone - 如何声明一个 MKPolygon

ios - 删除 UISearchBar 中搜索图标的动画

ios - 核心数据考验

iOS 通用应用程序默认图像

ios - 如何在 iPad 上显示 HTML5 视频海报?

iphone - observeValueForKeyPath 未调用

ios - 当用户位于特定位置时如何获取基于位置的内容?

ios - 更改 UISplitViewController 中 Master 的宽度

android - 网页出现在ipad屏幕的一半