Tag: 屏幕截图

以高质量的iOS截图

我正在以这种方式截取我的iPad 3屏幕: UIGraphicsBeginImageContext(self.view.frame.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; int num = arc4random() % 100000000000000; NSString* path = [documentsDirectory stringByAppendingPathComponent: [NSString stringWithFormat:@"%dtest.png", num]]; NSData* data = UIImagePNGRepresentation(viewImage); [data writeToFile:path atomically:YES]; 问题是我有一个重大的质量损失。 我可以看到像素,但它是一个iPad 3,所以它怎么样?

采取圈IOS的屏幕截图

我正在做一些UIButtons的截图,这些UIButtons是500宽度和500高度的圆圈。 由于屏幕截图只能以正方形forms显示,而且我不会在图像周围出现白色的angular落,所以我使用此代码: UIGraphicsBeginImageContext(self.Button3.layer.bounds.size); [self.Button3.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage* image2 = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSData* data = UIImagePNGRepresentation(image); [data writeToFile:BusinessCardPath atomically:YES]; 这完美的作品,它给我一张只有没有白色的angular落圆的照片。 但它可以被放大,因为它会丢失像素,它不包括在UIButton上的所有元素,如UILabels,而不是UIButton的子视图。 如果我使用这个代码: CGSize imageSize = CGSizeMake(310, 310); UIGraphicsBeginImageContext(self.Button3.layer.bounds.size); CGContextRef context = UIGraphicsGetCurrentContext(); /*CGContextTranslateCTM(context, -5, -50);*/ // Iterate over every window from back to front for (UIWindow *window in [[UIApplication sharedApplication] windows]) { if (![window respondsToSelector:@selector(screen)] || [window […]

防止在iOS应用中捕获屏幕

为了安全起见,我需要防止我的应用程序的用户抓屏。 我显示的内容是保密的,不应该复制到设备上。 我看到堆栈溢出,但Android的一个答案 。 在iOS中可能以某种方式防止屏幕捕获? 虽然通过点击几下button将截图捕获到图库中对于用户来说是非常有用的特征,但是对于防止这种情况的需求也是有限的。 任何指针?