How to find out if there is a hardware keyboard?

Possible duplicate:
How to determine if an external keyboard is present on the iPad?

When a user starts editing a text box in my iPhone user interface, I want to use the space between the text box and the keyboard for a list of related options.

Using the usual (on-screen) keyboard from iOS, there are several convenient notifications for listening that help me decide how much space I have left for the list between them.

However, when you attach (or simulate use) a hardware keyboard, these notifications are no longer published. Not too unexpected, but it leaves me a little complicated. If the user uses a hardware keyboard, I have more space for the list.

But how can I determine if a user has a hardware keyboard or not if there is no listening method or delegate? Or is there?

It should also be noted that the user can first use the application using the software keyboard, and then attach his hardware keyboard and continue to work with the application. At this point, the software keyboard will disappear, but the user is still editing the text box.

I found one old trick for this question, but it did not answer:

+5
1

, ( ).

UIView CGRectZero. show/hide .

UIView *inputAccessoryView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
inputAccessoryView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
textView.inputAccessoryView = inputAccessoryView;

…

- (void)keyboardWillShow:(NSNotification*)aNotification {
  NSLog(@"%@", [aNotification userInfo]);
}

- , UIKeyboardFrameEndUserInfoKey

// (NSDictionary *) {
//     UIKeyboardAnimationCurveUserInfoKey = 0;
//     UIKeyboardAnimationDurationUserInfoKey = "0.25";
//     UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {768, 264}}";
//     UIKeyboardCenterBeginUserInfoKey = "NSPoint: {384, 891}";
//     UIKeyboardCenterEndUserInfoKey = "NSPoint: {384, 1155}";
//     UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 758}, {768, 264}}";
//     UIKeyboardFrameChangedByUserInteraction = 0;
//     UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 1022}, {768, 264}}";
// }

- user721239 .

+3

All Articles