我试图在 iOS 7 上模拟“按下主页按钮”,但之前在 iOS 6 上使用的方法不起作用。我当然指的是越狱设备。
#include "GSEvent.h"
- (void)simulateHomeButton
{
struct GSEventRecord record;
memset(&record, 0, sizeof(record));
record.type = kGSEventMenuButtonDown;
record.timestamp = GSCurrentEventTimestamp();
GSSendSystemEvent(&record);
record.type = kGSEventMenuButtonUp;
GSSendSystemEvent(&record);
}
*更新
我真正需要的是一种像旧方法一样的通用方法,让我可以模拟所有物理按钮的压力
尝试这个。
[[%c(SBUIController)sharedInstance]clickedMenuButton];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)