Objective c IOS 7触摸通知
我想接收触摸的x,y坐标。我已经试过了,但在IOS 7上似乎不起作用。我得到以下错误: Tweak.xm:96:2:错误:没有用于调用的匹配函数 “IOHIDEventSystemClientScheduleWithRunLoop” IOHIDEventSystemClientScheduleWithRunLoop(ioHIDEventSystem,CFRu。。。 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/agiera/theosprojects/phoneit/theos/include/IOKit/hid/IOHIDEventSystemClient.h:72:7:注意: 候选函数不可行:无法转换不完整类型的参数 “void*”改为“IOHIDEventSystemClientRef”(也称为“IOHIDEventSystemClient*”) void IOHIDEventSystemClientScheduleWithRunLoop(IOHIDEventSystemC。。。 ^ Tweak.xm:97:2:错误:没有用于调用的匹配函数 “IOHIDEventSystemClientRegisterEventCallback” IOHIDEventSystemClientRegisterEventCallback(ioHIDEventSystem,ha。。。 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/agiera/theosprojects/phoneit/theos/include/IOKit/hid/IOHIDEventSystemClient.h:68:7:注意: 候选函数不可行:无法转换不完整类型的参数 “void*”改为“IOHIDEventSystemClientRef”(也称为“IOHIDEventSystemClient*”) 无效IOHIDEventSystemClientRegisterEventCallback(IOHIDEventSystem。。。 ^ 产生2个错误 IOS 7是否有更新的实现或其他方式来获得此功能Objective c IOS 7触摸通知,objective-c,iphone,jailbreak,ios7.1,iphone-privateapi,Objective C,Iphone,Jailbreak,Ios7.1,Iphone Privateapi,我想接收触摸的x,y坐标。我已经试过了,但在IOS 7上似乎不起作用。我得到以下错误: Tweak.xm:96:2:错误:没有用于调用的匹配函数 “IOHIDEventSystemClientScheduleWithRunLoop” IOHIDEventSystemClientScheduleWithRunLoop(ioHIDEventSystem,CFRu。。。 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/agiera/theosprojec
编辑: 代码:
有两种方法可以获取用户触摸位置: 1-使用
触摸开始
方法:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
// Get the specific point that was touched
CGPoint point = [touch locationInView:self.view];
NSLog(@"X location: %f", point.x);
NSLog(@"Y Location: %f",point.y);
}
2-使用UITapGestureRecognitor:
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(userTapped:)];
[tapRecognizer setNumberOfTapsRequired:1];
[tapRecognizer setDelegate:self];
[self.view addGestureRecognizer:tapRecognizer];
有两种方法可以获取用户触摸位置: 1-使用
触摸开始
方法:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
// Get the specific point that was touched
CGPoint point = [touch locationInView:self.view];
NSLog(@"X location: %f", point.x);
NSLog(@"Y Location: %f",point.y);
}
2-使用UITapGestureRecognitor:
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(userTapped:)];
[tapRecognizer setNumberOfTapsRequired:1];
[tapRecognizer setDelegate:self];
[self.view addGestureRecognizer:tapRecognizer];
您可以在
initTouchEventHandling()
中这样编写代码:
这个方法对我很有用。希望这能对你有所帮助。你可以在
initTouchEventHandling()中这样编写代码。
:
这个方法对我很有效。希望这能对你有所帮助。你能发布关于如何获取坐标的代码吗?检查这个Too我使用这个方法时也遇到了同样的错误。你认为用xcode 4版本替换我的iokit可以解决这个问题吗?xcode 5中的iokit有一些已知问题,但不是我的特定问题。你能发布关于如何获取坐标的代码吗你正在获取坐标。检查这个。我使用这个得到了相同的错误。你认为用xcode 4版本替换我的iokit可能会解决这个问题吗?xcode 5的iokit有一些已知的问题,但不是特定于我的。谢谢你的代码。不过我应该更清楚。我正在进行cydiasubstrate调整,我想联系一下任何地方的位置,包括锁屏和键盘。我有一个系统图像视图,我可以连接手势识别器,或者一个类,我可以将touchsbegind方法连接到其中,不会把事情搞砸?谢谢你的代码。不过我应该更清楚。我正在做一个cydiasubstrate调整,我想从我在任何地方,包括锁屏和键盘。我有一个系统图像视图,我可以将手势识别器附加到其中,或者一个类,我可以将touchesbeent方法挂到其中,这样就不会把事情搞砸。谢谢。你能发布一个示例生成文件和导入吗?也许还有你的头文件源吗?我的编译器无法识别这些类。你能吗发布一个示例makefile和imports?可能还有您的头文件源?我的编译器无法识别这些类。
static void initTouchEventHandling() {
IOHIDEventSystemClientRef ioHIDEventSystem = IOHIDEventSystemClientCreate(kCFAllocatorDefault);
IOHIDEventSystemClientScheduleWithRunLoop(ioHIDEventSystem, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
IOHIDEventSystemClientRegisterEventCallback(ioHIDEventSystem, (IOHIDEventSystemClientEventCallback)handle_event, NULL, NULL);
//add other custom code...
}