-
Notifications
You must be signed in to change notification settings - Fork 0
AccessBraille API Documentation
Using the ABKeyboard interface is quite simple, there are a few option for doing so. If you wish to explicitly handle all the returned data from the keyboard you simply need to set yourself as the delegate and add the protocol methods.
#import <ABKeyboard/ABKeyboard.h>
@interface ViewController () <ABKeyboard>
@end
- (void)viewDidLoad
{
ABKeyboard *keyboard = [[ABKeyboard alloc] initWithDelegate:self];
}
- (void)characterTyped:(NSString *)character withInfo:(NSDictionary *)info
{
// Handle characters here
}
- (void)wordTyped:(NSString *)word withInfo:(NSDictionary *)info
{
// Handle completed word, this is where expanded shorthand gets sent
}
Another, simpler option, to using the keyboard is to pass in a UITextView and let ABKeyboard be the first responder.
#import <ABKeyboard/ABKeyboard.h>
@interface ViewController () <ABKeyboard>
@property UITextView *myOutput;
@end
- (void)viewDidLoad
{
ABKeyboard *keyboard = [[ABKeyboard alloc] initWithDelegate:self];
[keyboard setOutput:_myOutput];
}
Setting up the keyboard to work best for the user is very important, so make sure to open theses options up to your users.
@property (assign) ABGrade grade
Two types of braille are supported, grade one and two. Grades are defined in ABTypes.
[userDefaults setFloat:0.6 forKey:KeyboardTransparency];
Keyboard transparency is set through NSUserDefaults
. It is a float value between 0.0 and 1.0. KeyboardTransparency
is defined in ABTypes.
@property (assign) BOOL enabled
Set if the keyboard should activate or not.
@property (assign) int spaceOffset
Set a custom buffer area for where the keyboard detects a space.
The keyboard provides status information about its state.
@property BOOL keyboardActive
If the keyboard is currently active or not.
-keyboardDidBecomeActive
Part of the ABKeyboard protocol, delegate gets this call on keyboard activation.
-keyboardDidDismiss
Part of the ABKeyboard protocol, delegate gets this call when is keyboard is dismissed.
ABKeyboard comes with a few extra features that makes using the keyboard easier and providing the best user experience.
In addition to using ABSpeak, ABKeyboard has a -startSpeakingString:
method that can be used to provide audio feedback to the user. To use ABSpeak without a keyboard instance, use [ABSpeak sharedInstance]
to get the ABSpeak object.
The sentence and word parsing class that's used by the keyboard is also available to the user. See ABParser:
/* Parses a sentence into an array of words */
+ (NSArray *)arrayOfWordsFromSentence:(NSString *)sentence;
/* Parses word down to array of characters */
+ (NSArray *)arrayOfCharactersFromWord:(NSString *)word;
ABBrailleOutput
is a UIView
with a text property that outputs braille. Currently only supports braille grade 1, and not numbers. Planning to just use the SimBraille font for this instead of doing the rendering ourselves.
Definitions of all the custom types can be found in the ABTypes header.
ABKeyboard was built for and supports iOS 6.1+ for iPad.
To start using ABKeyboard in your project:
- Build the AccessBrailleAggregate and the
<ABKeyboard.framework>
will build intoAccessBraille/Products
. - Add
<ABKeyboard.framework>
under "Linked Frameworks and Libraries" in your project. - Start using ABKeyboard!