美文网首页
iOS获取启动页LaunchImage图片

iOS获取启动页LaunchImage图片

作者: 光头金项链的和尚 | 来源:发表于2016-11-04 11:00 被阅读1091次

    ```

    +(UIImage *)getTheLaunchImage

    {

    CGSize viewSize = [UIScreen mainScreen].bounds.size;

    NSString *viewOrientation = nil;

    if (([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortraitUpsideDown) || ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortrait)) {

    viewOrientation = @"Portrait";

    } else {

    viewOrientation = @"Landscape";

    }

    NSString *launchImage = nil;

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

    for (NSDictionary* dict in imagesDict)

    {

    CGSize imageSize = CGSizeFromString(dict[@"UILaunchImageSize"]);

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

    {

    launchImage = dict[@"UILaunchImageName"];

    }

    }

    return [UIImage imageNamed:launchImage];

    }

    ```

    相关文章

      网友评论

          本文标题:iOS获取启动页LaunchImage图片

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