Created
August 27, 2012 14:43
-
-
Save mumumu/3489109 to your computer and use it in GitHub Desktop.
tibar image overlay module patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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