有什么方法可以模拟在 iOS 模拟器上截屏(相当于家庭 + 设备电源)?我的目标不是保存 (cmd + s) 或复制屏幕快照(从模拟器菜单项),而是捕获 UIApplicationUserDidTakeScreenshotNotification 事件。
最佳答案
使用LLDB模仿截图NSNotification:
(lldb) expr [[NSNotificationCenter defaultCenter] postNotificationName:(NSNotificationName)UIApplicationUserDidTakeScreenshotNotification object:nil]
如果您也想在断点处停止,请将 --ignore-breakpoints false --
传递给 expr
命令:
(lldb) expr --ignore-breakpoints false -- [[NSNotificationCenter defaultCenter] postNotificationName:(NSNotificationName)UIApplicationUserDidTakeScreenshotNotification object:nil]
关于ios - 如何在iOS模拟器中模拟截屏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28209538/