我有几个习惯UIMenuItems用a中的选择做事UIWebView.在该选择上运行操作后,我想隐藏选择句柄copy:.
我已经尝试使用window.getSelection().removeAllRanges();,并且工作原理window.getSelection()不再返回任何内容,但文本选择句柄保持可见.
有没有办法删除选择和句柄?
编辑:我不需要它成为JS解决方案,但我不能通过重新加载webview来松散状态.
我有一些透明的图像,我从文件系统加载到UIImageView视图中.出于我的目的,我需要UIImageView将文件中的图像与文件系统上的文件进行比较.所以我做了类似以下的事情:
NSString *directoryPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *imageFile = [NSString stringWithFormat:@"%@/image.png", directoryPath];
if ([[NSData dataWithContentsOfFile:imageFile] isEqualToData:UIImagePNGRepresentation([imageView image])]) {
NSLog(@"Equal");
} else {
NSString *dataDescription = [[[NSData dataWithContentsOfFile:feltFile] description] substringToIndex:100];
NSString *imageDescription = [[UIImagePNGRepresentation([backgroundImageView image]) description] substringToIndex:100]
NSLog(@"Unequal: %@ %@", dataDescription, imageDescription);
}
Run Code Online (Sandbox Code Playgroud)
我知道他们是PNG图像.打印时,这两个描述都不是NULL.但他们是不平等的.
为什么会这样?