Screenshots on Device vs Simulator

旧巷老猫 提交于 2020-01-06 12:50:49

问题


Why would does this work on simulator but not on a device.

I am trying to capture a screenshot of a view that contains more than one AVPlayer.I can snap a frame from a player, but I need the actual screenshot as the view contains a few players, in specific locations on the screen at once.

There are multiple threads regarding this topic, but I am yet to find an answer.

- (UIImage *) takeScreenShot
{
    UIImage *image;
    CGSize snapArea = self.view.bounds.size;
    int bottomTobBarHeight = 44;
    snapArea.height = snapArea.height - bottomTobBarHeight;
    UIGraphicsBeginImageContextWithOptions(snapArea, YES, 1.0);
    [self.view drawViewHierarchyInRect:self.view.bounds afterScreenUpdates:YES];
    image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}

来源:https://stackoverflow.com/questions/22681147/screenshots-on-device-vs-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!