in|situ| Lab - Log In

Bipad Installation

  1. Download the Bipad test application xcode project.
  2. Download the BipadRessources.bundle file and copy it into the directory of the test application xcode project.
  3. Download the Bipad static library and copy it into the same folder.
  4. enter the name of the appropriate test application in the "activeApplication" plist file. Compile and run the project.

Bipad Documentation

Creating Bipad Applications

A Bipad application receives the Bipad events and handles their functionality in your application.

Subclass the BipadApplication class and adopt the BipadProtocol

@interface BiDraw : BipadApplication<BipadProtocol> {

The BipadApplication is a subclass of an UIViewController. Make sure to activate Bipad as the follwing in your viewDidLoad method:

BipadOverlayView* overlayView = [[BipadManager bipadManager] bipadOverlayView];
     [overlayView biPadActivated:YES];

In the main UIViewController class of your xcode project, you need to instantiate the BipadManager. Open the .xib file of your project in Interface builder and set the UIView to the BipadAreaView class. Make sure that your project loads the BipadAreaView from the framework as follows:

-(void) awakeFromNib
     manager = [[BipadManager alloc] init];
     [manager setDelegate:self];
     [BipadManager version];

- (void)viewDidLoad {
    [super viewDidLoad];
     [manager installBipadController];
     [self.view becomeFirstResponder];
     viewController = self;

Now instantiate the appropriate Bipad application in your viewDidLoad method:

CGRect drawingFrame = CGRectMake(60, 30, 600, 900);
BiDraw* drawingApp = [[BiDraw alloc] initWithFrame:drawingFrame];
//define how users register for bipad interactions in zones.
// either buttonCreationTypeOneTouchesRegister or buttonCreationTypeAllTouchesRegister. Either users double-tap with one finger in order to create all buttons in the zones or users double-tap, e.g., with two fingers in order to create two buttons or three fingers in order to create three buttons.
[drawingApp setButtonCType:buttonCreationTypeOneTouchesRegister];
[manager registerApplication:drawingApp];

//define Bipad taps, chords or gestures here. (see below)

[self.view addSubview:drawingApp.view];
[drawingApp release];

Bipad protocol: BipadProtocol and BipadGestureProtocol

There are two protocols in Bipad. The main protocol, BipadProtocol, sends you a Bipad event through the bipadInteraction: method. However, in cases where you want to add new kinds of gestures, you might want to receive more specific touch information.

@protocol BipadProtocol

@protocol BipadGestureProtocol <BipadProtocol>
- (void)BipadTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)BipadTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)BipadTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)BipadTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;

This is an example implementation of the BipadProtocol method [bipadInteraction:]. It varifies that the user pressed the STROKE_SIZE_UP or STROKE_SIZE_DOWN button in order to change the stroke size in an drawing application (see BiDraw in the BipadTestApplication Xcode project).


   if([be.function isEqualToString:STROKE_SIZE_UP]){
      if(be.event == BipadEventDiscreteTapPressed){
    }else if([be.function isEqualToString:STROKE_SIZE_DOWN]){
      if(be.event == BipadEventDiscreteTapPressed){


Bipad Events

A Bipad event contains the following parameters:

typedef enum{
     BipadEventDiscreteTapPressed = 0,
     BipadEventDiscreteTapReleased = 1,
     BipadEventContinuousTapPressed = 2,

@interface BipadEvent : NSObject {
     BipadInteraction* bipadInteraction;
     NSString* function;
     bipadEvent event;
     CGPoint position;

Creating Bipad Taps

Each Bipad interaction you create has to specify in which BipadZone it should appear. The button order will be in the order you create the Bipad interactions in. If there are Bipad Zones you do not specify an interaction for, the Bipad zone will not be active as long as your application is in focus. There are 5 bipad zones:

typedef enum {
     BipadAreaThumbHorizView = 0,
     BipadAreaThumbVertView = 1,
     BipadAreaThumbCornerView = 2,
     BipadAreaFingersVertView = 3,
     BipadAreaFingersHorizView = 4

There are two types of BipadTap interaction:

  • discrete tap (e.g. calling the main menu when tapping the button)
[manager defineBipadInteraction:bipadTaps inBipadZone:BipadAreaFingersHorizView forApplication:pdf   withCallback:MAIN_MENU];
  • continuous tap (e.g. press and hold to continuously zoom in).
BipadTap* zoomIn =(BipadTap*)[manager defineBipadInteraction:bipadTaps                                                              inBipadZone:BipadAreaThumbCornerView forApplication:panZoomApp withCallback:ZOOM_IN];
[zoomIn setInputMode:inputModeContinous]; //default is inputModeDescrete
[zoomIn setTimerSchedule:0.5]; // time intervall of sending events

Creating Bipad Gestures

Bipad gestures have also to indicate the bipad zone they should appear in (see Bipad Taps above). You need to indicate also the slide direction. There are 9 possible slide directions.

typedef enum{
     SlideDirectionDefault = 0,
     SlideDirectionLeft = 1,
     SlideDirectionRight = 2,
     SlideDirectionUp = 3,
     SlideDirectionDown = 4,
     SlideDirectionLeftUp = 5,
     SlideDirectionRightDown = 6,
     SlideDirectionLeftDown = 7,
     SlideDirectionRightUp = 8

You create a Bipad gesture as follows:

BipadGesture* bg = (BipadGesture*)[manager defineBipadInteraction:bipadGestures inBipadZone:BipadAreaThumbCornerView
forApplication:pdf withCallback:MAIN_MENU];
[bg addBipadSwipe:SlideDirectionLeft];

In case you want to define your own gestures, you can adopt the BipadGestureProtocol (see description above) and create your own gesture recognizer.

Creating Bipad Chords

When you create Bipad chords you need to create the main button, e.g. a button with the label "stroke", and the submenu buttons that appear when the user holds down the "stroke" button. You define the submenu in [configureSubMenu]. The submenu buttons will apear in the order you specify in the NSArray. You can either give button images or labels to Bipad in order to change the look of the buttons.

BipadInteraction* bi =[manager defineBipadInteraction:bipadChords inBipadZone:BipadAreaFingersVertView forApplication:drawingApp

[(BipadChord*)bi configureSubMenu:[NSArray arrayWithObjects:STROKE_SIZE_UP, STROKE_SIZE_DOWN,nil] withImages:NULL andLabels:[NSArray arrayWithObjects:@"+", @"-",nil]];