-2
와 함께 스크린 샷을 가지고 나는 아이폰 OS는 - 상태 표시 줄
+ (UIImage *)screenshot {
CGSize imageSize = [[UIScreen mainScreen] bounds].size;
if (NULL != UIGraphicsBeginImageContextWithOptions) {
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0);
} else {
UIGraphicsBeginImageContext(imageSize);
}
CGContextRef context = UIGraphicsGetCurrentContext();
for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
if (![window respondsToSelector:@selector(screen)] || [window screen] == [UIScreen mainScreen]) {
CGContextSaveGState(context);
CGContextTranslateCTM(context, [window center].x, [window center].y);
CGContextConcatCTM(context, [window transform]);
CGContextTranslateCTM(context,
-[window bounds].size.width * [[window layer] anchorPoint].x,
-[window bounds].size.height * [[window layer] anchorPoint].y);
[[window layer] renderInContext:context];
CGContextRestoreGState(context);
}
}
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
그러나, 나는 그것으로 하나의 작은 문제가 ... 사과 문서에서이 코드를 얻을. 내 스크린 샷에 상태 표시 줄을 포함시키고 싶습니다. 어떻게해야합니까? 아니면이 작업을 수행하는 더 좋은 방법이 있습니까? 그것을 할 수있는 가장 좋은 방법입니다 앱 스토어 승인 가능한 아니지만 여기에 헨리
@livingtech Ooops. 죄송합니다. 내가 검토해볼 께. –