Two changes in iPad 3.2 (font name + keyboard class name)

Here are two things I just discovered while playing with the iPad SDK (3.2) – hope they help:

If you've been using @"ArialUnicodeMS" as your font in your iPhone apps, you should notice that they break in 3.2. The new name is @"Arial Unicode MS".

Secondly, if you're doing anything with the Keyboard view you were probably detecting it by traversing the object hierarchy and checking for the classname of the keyboard. On the iPhone this is UIKeyboard. However, on the iPad, it is UIPeripheralHostView. I was using a UIApplication category from Matt Gallagher to do this in Feathers and just updated it thanks to this blog post from Bryan Scott Gruver.

@interface UIApplication (KeyboardView)
- (UIView *)keyboardView;
@end

@implementation UIApplication (KeyboardView)
- (UIView *)keyboardView
{
  for (UIWindow *tempWindow in [[UIApplication sharedApplication] windows]) for (UIView *keyboard in [tempWindow subviews]) {
    // Check and see if those subviews contain a view with the prefix of UIKeyboard (iPhone) or UIPeripheralHostView (iPad Simulator)
    if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES || [[keyboard description] hasPrefix:@"<UIPeripheralHostView"] == YES) {
      return keyboard;
    }
  }

  return nil;
}
@end

(One thing to note is that, new to 3.2, you can now specify inputView and inputAccessoryView properties to replace the system keyboard and add a toolbar to it, respectively.)

Comments