Skip to content

Instantly share code, notes, and snippets.

@mumumu
Created August 27, 2012 14:43
Show Gist options
  • Save mumumu/3489109 to your computer and use it in GitHub Desktop.
Save mumumu/3489109 to your computer and use it in GitHub Desktop.
tibar image overlay module patch
Index: Classes/TibarModule.m
===================================================================
--- Classes/TibarModule.m (revision 17)
+++ Classes/TibarModule.m (working copy)
@@ -257,6 +257,36 @@
[pickerCancelCallback retain];
}
+ // overlay view
+ if ([args objectForKey:@"overlay"] != nil)
+ {
+ NSString *overlayPath = [TiUtils stringValue:[args objectForKey:@"overlay"]];
+
+ NSData *dt = [NSData dataWithContentsOfURL:
+ [NSURL URLWithString:overlayPath]];
+ UIImage *image = [[UIImage alloc] initWithData:dt];
+ UIImageView *iv = [[UIImageView alloc] initWithImage:image];
+
+ UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];
+ [view addSubview:iv];
+
+ CGRect newBounds = CGRectMake(0, 0, 320, 480);
+ CGPoint newCenter;
+ newCenter.x = 160;
+ newCenter.y = 240;
+ [view setBounds:newBounds];
+ [view setCenter:newCenter];
+ reader.cameraOverlayView = view;
+
+ } else {
+ if (pickerErrorCallback!=nil){
+ id listener = [[pickerErrorCallback retain] autorelease];
+
+ NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
+ [self _fireEventToListener:@"error" withObject:dictionary listener:listener thisObject:nil];
+ }
+ }
+
// show
TiApp * tiApp = [TiApp app];
[tiApp showModalController:reader animated:YES];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment