Skip to content

Instantly share code, notes, and snippets.

@jontelang
Created April 25, 2013 03:14
Show Gist options
  • Save jontelang/5457253 to your computer and use it in GitHub Desktop.
Save jontelang/5457253 to your computer and use it in GitHub Desktop.
s
static UIView *pianoView;
static int count = 0;
static NSString* PIN = @"";
static int PINLength;
@interface key : UIView <UIGestureRecognizerDelegate>
{
UIView *touches;
}
-(void)unlock;
-(void)addToPIN:(int)number;
@end
@implementation key
-(id)initWithFrame:(CGRect)frame{
if( (self = [super initWithFrame:frame]) )
{
....
PINLength = 5;
}
return self;
}
-(void)touchesBegan:(NSSet *)touchess withEvent:(UIEvent *)event
{
....
[self addToPIN:self.tag];
..
}
-(void)touchesEnded:(NSSet *)touchess withEvent:(UIEvent *)event
{
[self unlock];
}
-(void)touchesCancelled:(NSSet *)touchess withEvent:(UIEvent *)event
{
[self unlock];
}
-(void)unlock
{
... use PIN to unlock
}
-(void)addToPIN:(int)number
{
//NSLog(@"----");
//NSLog(@"----");
//NSLog(@"----");
//NSLog(@"----");
//NSLog(@"---- %i", number);
//NSLog(@"---- %i", [PIN length]);
//NSLog(@"---- %i", PINLength);
//NSLog(@"---- %@%i", PIN,number);
PIN = [NSString stringWithFormat:@"%@%i", PIN, number];
NSLog(@"---- %@", PIN);
//if( [PIN length] > PINLength )
//{
// PIN = [PIN substringWithRange:NSMakeRange(1, PINLength)];
//}
}
@end
@interface SBDeviceLockViewWithKeypadPhone : UIView <UIGestureRecognizerDelegate>
{
}
-(void)togglePiano:(UITapGestureRecognizer*)recognizer;
@end
%hook SBDeviceLockViewWithKeypadPhone
- (id)keypadView
{
id d = %orig;
if( !pianoView )
{
pianoView = [[UIView alloc] initWithFrame:((UIView*)d).bounds];
...
...
...
...
for (int i = 0; i < 7; ++i)
{
key *k = [[key alloc] initWithFrame:CGRectMake(6+i*44,21,44,190)];
k.tag = i;
[k setUserInteractionEnabled:YES];
[pianoView addSubview:k];
[k release];
}
PIN = @"";
}
return d;
}
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment