+ (UIImage *)getSharedScreenView{ UIWindow *screenWindow = [[UIApplication sharedApplication]keyWindow]; ScreenView *currentView = [[[self class] alloc] init]; currentView.frame = screenWindow.bounds; [screenWindow addSubview:currentView]; //UIGraphicsBeginImageContext() 图片会失真模糊 UIGraphicsBeginImageContextWithOptions(screenWindow.frame.size, NO, 0.0);//图片不模糊 [screenWindow.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage* viewImage =UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); [currentView removeFromSuperview]; //UIImageWriteToSavedPhotosAlbum(viewImage,nil,nil,nil); //写入到相册 return viewImage; }