美文网首页
ios 中用纯代码设置launchImage

ios 中用纯代码设置launchImage

作者: JackieCheung | 来源:发表于2016-06-20 14:04 被阅读0次

    CGSizeviewSize =self.window.bounds.size;

    NSString*viewOrientation =@"Portrait";//横屏请设置成 @"Landscape"

    NSString*launchImage =nil;

    NSArray* imagesDict = [[[NSBundlemainBundle] infoDictionary] valueForKey:@"UILaunchImages"];

    for(NSDictionary* dictinimagesDict)

    {

    CGSizeimageSize =CGSizeFromString(dict[@"UILaunchImageSize"]);

    if(CGSizeEqualToSize(imageSize, viewSize) && [viewOrientation isEqualToString:dict[@"UILaunchImageOrientation"]])

    {

    launchImage = dict[@"UILaunchImageName"];

    }

    }

    UIImageView*launchView = [[UIImageViewalloc] initWithImage:[UIImageimageNamed:launchImage]];

    launchView.frame=self.window.bounds;

    launchView.contentMode=UIViewContentModeScaleAspectFill;

    [self.windowaddSubview:launchView];

    [UIViewanimateWithDuration:2.0f

    delay:0.0f

    options:UIViewAnimationOptionBeginFromCurrentState

    animations:^{

    launchView.alpha=0.0f;

    launchView.layer.transform=CATransform3DScale(CATransform3DIdentity,1.2,1.2,1);

    }

    completion:^(BOOLfinished) {

    [launchView removeFromSuperview];

    }];

    相关文章

      网友评论

          本文标题:ios 中用纯代码设置launchImage

          本文链接:https://www.haomeiwen.com/subject/iiuwdttx.html