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