0

Thank you for UITapGestureRecognizer!

Initially I didn’t think a whole lot about the UITapGestureRecognizer in iOS. I figured it might save someone some time wiring up some touch code, but outside of that I felt it was nothing more than a nice convenience. After today I am so thankful that some developers and managers at Apple included it into iOS for developers to use.  … Continue Reading

Popularity: 1%

0

55 million iPads

Since April 2010… that’s amazing.

Popularity: 1%

0

Heart the PAM 90

So sweet.

20120121-101010.jpg

Popularity: 1%

0

Thanks Adobe…

I’ve been working on an Illustrator file for a few days and suddenly I can’t open the file any longer. I have some options, but this was a large kick in the ding-ding.
ding ding

Popularity: 1%

0

Android hardware. It’s difficult to pay attention.

There are so many Android phones. Some support this, other support that. Some run this X version of Android, some can’t, some aren’t allowed to. Some come skinned, some don’t. There are tablets and now there are phablets. So many look like Apple hardware or are trying to that it’s hard to distinguish them. It’s a mess and it’s a lot of work to keep paying attention to the landscape of it all. It’s the visual of the running conveyor belt of crap and the worker at the end can’t keep up. It all ends up on the floor. Perhaps this will change some day. And I still need to generically develop for Android.

Popularity: 1%

0

Sandwich à la crème glacée

When I see someone get über excited about their phone lasting almost an entire business day with little use… gah.

Popularity: 1%

0

[iOS] Reading BT keyboard presses

Bluetooth Keyboard ImageThere are times when you’ll want to read key presses coming from a Bluetooth keyboard in your iOS application. This post addresses a technique I’ve come up with to do this

This method uses NSNotificationCenter and a UITextField to do this. A thing to note is that if you don’t have a BT keyboard paired with your iDevice, you’ll get the virtual keyboard to appear. If paired, you won’t see the virtual keyboard, so there is no need to force-hide it or anything like that. If the keyboard becomes unpaired or powers off, you’ll see the virtual keyboard pop up from the bottom.

So we are going to read the single key presses coming into the iOS application (much like we do in Flash… however we don’t get a keyUp, keyDown, etc.)

Place a UITextField in your application via Xcode & declare it in your code (ie. IBOutlet UITextField *textField, etc.)… here is the little crust. This is NOT localized!

#pragma mark - Keyboard

- (void)handle_TextFieldTextChanged:(id)notification {
    NSString *sValue = self.textField.text;
    if([sValue isEqualToString:@"a"]){
        NSLog(@"a was pressed");
    }
    //Avoid a loop for the change, happens even on setting to empty string
    [self.textField resignFirstResponder];
    self.textField.text = @"";
    [self.textField becomeFirstResponder];
}

- (void)registerForTextFieldNotifications {
    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
    [notificationCenter addObserver:self
                           selector:@selector (handle_TextFieldTextChanged:)
                               name:UITextFieldTextDidChangeNotification
                             object:self.textField];
}

#pragma mark - View lifecycle

- (void)viewDidLoad {
    [super viewDidLoad];
    self.textField.hidden = YES;
    [self.textField becomeFirstResponder];
    [self registerForTextFieldNotifications];
}

You can hide the control offscreen. I chose to simply hide it altogether since I used Xcode to place the control and didn’t do it programmatically.

I haven’t done anything in regards to localization and this technique only reads a character at a time without any notion of keyDown and keyUp which would be nice to determine a press and hold using an NSTimer or something like that. The only solution I can think of at the moment would be for a custom keyboard that itself sent the correct character and then followed the release with a custom value used as a delimiter that you could respond to while ignoring it’s actual value. I’ll keep thinking about that bit.

Popularity: 2%