gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-01 19:11:51 25 4
gpt4 key购买 nike

启动 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com