iOS version 26.0, get pixel alpha value invalid if subviews contains WKWebView

using renderInContext fetch pixel faild if subviews contains WKWebView, the code is as follows:

self.contentView = [SimpleClearContentView alloc] initWithFrame:CGRectMake(0, 100, 100, 100)]; contentView.backgroundColor = [UIColor clearColor]; self.contentView.webView = [[WKWebView alloc] init]; self.contentView.webView.frame = CGRectMake(0, 0, 50, 100); // make web view clear bg color self.contentView.webView.backgroundColor = [UIColor clearColor]; self.contentView.webView.scrollView.backgroundColor = [UIColor clearColor]; // webView load clear background webpage [self.contentView.webView loadRequest:***]; [self.view addSubView:contentView];

// this method still return 0.0f anywhere

-(CGFloat)getPixelAlphaAtPoint:(CGPoint)point { unsigned char pixel[4] = {0}; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(pixel, 1, 1, 8, 4, colorSpace, kCGBitmapAlphaInfoMask & kCGImageAlphaPremultipliedLast); CGContextTranslateCTM(context, -point.x, -point.y); WKWebView *webView = self.contentView.webView; [webView.layer renderInContext:context]; CGContextRelease(context); CGColorSpaceRelease(colorSpace); CGFloat alpha = pixel[3]/255.0; return alpha; }

This is a known issue, and will be fixed in a future update.

iOS version 26.0, get pixel alpha value invalid if subviews contains WKWebView
 
 
Q