Skip to content

Instantly share code, notes, and snippets.

@boucher
Forked from anonymous/gist:16352
Created October 12, 2008 01:49
Show Gist options
  • Save boucher/16353 to your computer and use it in GitHub Desktop.
Save boucher/16353 to your computer and use it in GitHub Desktop.
import <Foundation/CPObject.j>
import "CalculatorLogic.j"
@implementation CalculatorButton : CPButton
{
}
+(id)newCalculatorButton:(CPText)buttonText target:(id)aTarget selector:(SEL)aSelector rect:(CGRect)aFrame
{
var returnValue = [[CalculatorButton alloc] initWithFrame: aFrame ];
[returnValue setTitle:buttonText];
[returnValue setTarget:aTarget];
[returnValue setAction:aSelector];
[returnValue setBezelStyle:CPHUDBezelStyle];
[returnValue setObjectValue:buttonText];
return returnValue;
}
@end
var contentView = [self contentView];
for (var i=0; i<9; i++)
{
var button = [CalculatorButton newCalculatorButton:""+i target:calculatorLogic selector:@selector(press:) rect:[self buttonWidth:1 column:1 extend:NO]];
[contentView addSubview: button];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment