0

In my app, I need to input specified text into the first responder, I have no idea about that, I think first I should get the focused control, which may be UITextField, UITextView or something else defined by the developers.But how can I get the focused controls?Particularly I want to do that in a tweak for jailbroken iPhone. Or maybe my train of thought is totally wrong, maybe I should send some IOHIDEvents to do that? Thank you!

Suge
  • 2,808
  • 3
  • 48
  • 79
  • What do you mean by cursor focused? Do you want to get the first responder? – Tomer Jan 17 '15 at 10:06
  • Yes, I mean the first responder. – Suge Jan 17 '15 at 10:08
  • Do you want to get the first responder only inside your app, or in all apps? – Tomer Jan 17 '15 at 10:09
  • I want to get the first responder in all apps. – Suge Jan 17 '15 at 10:10
  • Okay, Have you seen [this](http://stackoverflow.com/questions/1823317/get-the-current-first-responder-without-using-a-private-api)? I'm not sure it will work for all apps, but it uses a private API (which you can use without a problem) – Tomer Jan 17 '15 at 10:11
  • Thank you, I'll try @JakobEgger 's answer at that page, I think it's fishier. – Suge Jan 17 '15 at 10:18
  • Please tell me if it worked for you. – Tomer Jan 17 '15 at 10:29
  • I've tried, the answer are not applicable.It extends `UIResponder`, but it have to be imported to every place to make it work, but that's not practical. – Suge Jan 17 '15 at 10:30
  • Have you tried the code in the question itself? I thought this one might work for you because it uses private API – Tomer Jan 17 '15 at 10:34
  • I haven't tried it, but does `[[[UIApplication sharedApplication] keyWindow] performSelector:@selector(firstResponder)]` only get the first responder of the application in which the programing is running? My tweak will run in `SpringBoard`, but I want to get the first responder of all the applications these are at the front most. – Suge Jan 17 '15 at 10:39
  • Maybe you can run some code whenever an application is launched by the user, and save its `UIApplication` object? – Tomer Jan 17 '15 at 10:52
  • Yes, thank you, I'll try it, or maybe injecting some functions into `firstResponder` method of the `UIApplication` will work. – Suge Jan 17 '15 at 10:55
  • What kind of code would you inject into `firstResponder` method? You wouldn't want to prevent from other applications to get their own first responder. – Tomer Jan 17 '15 at 11:02
  • May inject some codes can register the current first responder to a variable I can access. – Suge Jan 17 '15 at 11:13

0 Answers0