Skip to content

加载网络图片后显示不出来 #218

@lmk499480947

Description

@lmk499480947

IOS手机版本 15.0.2
pod.lock部分

  • SDWebImage (5.8.3):
    • SDWebImage/Core (= 5.8.3)
  • GKPhotoBrowser/Core (3.1.6):
    • GKPhotoBrowser/Resources
  • GKPhotoBrowser/Cover (3.1.6):
    • GKPhotoBrowser/Core
  • GKPhotoBrowser/Resources (3.1.6)
  • GKPhotoBrowser/SD (3.1.6):
    • GKPhotoBrowser/Core
    • SDWebImage (~> 5.0)

//加载url图片

            NSURL *url = [NSURL URLWithString:@"https://www.w3.org/2008/site/images/logo-w3c-mobile-lg.png"];
            NSBundle *bundle = [NSBundle bundleForClass:[C4GameSDK class]];
            UIImage *bgImage = [UIImage imageNamed:@"C4YGGameSDK.bundle/Image_Browser_Bg" inBundle:bundle compatibleWithTraitCollection:nil];
            
            GKPhoto *photo = [GKPhoto new];
            photo.url = url;
            GKPhotoBrowser *browser = [GKPhotoBrowser photoBrowserWithPhotos:@[photo] currentIndex:0];
            GKPhotoBrowserConfigure *configure =  GKPhotoBrowserConfigure.defaultConfig;
            configure.showStyle= GKPhotoBrowserHideStyleNone;
            configure.hideStyle= GKPhotoBrowserHideStyleZoomScale;
            configure.loadStyle= GKPhotoBrowserLoadStyleCustom;
            configure.failStyle= GKPhotoBrowserFailStyleCustom;
            configure.maxZoomScale = 4;

            
            // 不使用内存缓存
            [SDImageCache sharedImageCache].config.shouldCacheImagesInMemory = YES;
            
            UIColor *bgColor = [UIColor colorWithPatternImage:bgImage];
            configure.bgColor=bgColor;
            browser.view.layer.contents = (id)bgImage.CGImage;
            
            // 指定imageProtocol
            [configure setupWebImageProtocol:[[GKSDWebImageManager alloc] init]];
            if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
                configure.isFollowSystemRotation = YES;
            }
            browser.configure = configure;
            UIViewController *currentVC = [C4AnalyticsUtils topViewController];
            browser.delegate = self;
            [browser showFromVC:currentVC];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions