Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 在iPhone上复制UIWebView中的文本时如何更改镜像中的颜色_Objective C_Ios4_Uiwebview_Copy Paste - Fatal编程技术网

Objective c 在iPhone上复制UIWebView中的文本时如何更改镜像中的颜色

Objective c 在iPhone上复制UIWebView中的文本时如何更改镜像中的颜色,objective-c,ios4,uiwebview,copy-paste,Objective C,Ios4,Uiwebview,Copy Paste,我有一个黑色背景和白色(浅灰色)文本的UIWebView。在选择要复制的文本时,它几乎不可用,因为“镜像”默认为白色背景色。有没有办法改变这种行为 截图:因为Ben Gottlieb已经回答了我面前的问题: - (void) drawRect: (CGRect) rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGRect bounds = self.bounds; CGIm

我有一个黑色背景和白色(浅灰色)文本的UIWebView。在选择要复制的文本时,它几乎不可用,因为“镜像”默认为白色背景色。有没有办法改变这种行为


截图:

因为Ben Gottlieb已经回答了我面前的问题:

- (void) drawRect: (CGRect) rect {
    CGContextRef    context = UIGraphicsGetCurrentContext();
    CGRect          bounds = self.bounds;
    CGImageRef      mask = [UIImage imageNamed: @"loupeMask"].CGImage;
    UIImage         *glass = [UIImage imageNamed: @"loupeImage"];

    CGContextSaveGState(context);
    CGContextClipToMask(context, bounds, mask);
    CGContextFillRect(context, bounds);
    CGContextScaleCTM(context, 2.0, 2.0);

    //draw your subject view here

    CGContextRestoreGState(context);

    [glass drawInRect: bounds];
}

有关更多详细信息,请查看

,虽然此链接可以回答问题,但最好在此处包含答案的基本部分,并提供链接以供参考。MichaelRoland注意到,如果链接页面发生更改,只有链接的答案可能会无效。