blob: 0168f4e5eb17e270dc5f11b8379047c51d68d781 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
//
// TabReaderAppDelegate.m
// TabReader
//
// Created by spadix on 5/3/11.
//
#import "TabReaderAppDelegate.h"
#import "ResultsViewController.h"
@implementation TabReaderAppDelegate
@synthesize window=_window;
@synthesize tabBarController=_tabBarController;
- (BOOL) application: (UIApplication*) application
didFinishLaunchingWithOptions: (NSDictionary*) options
{
// force class to load so it may be referenced directly from nib
[ZBarReaderViewController class];
ZBarReaderViewController *reader =
[self.tabBarController.viewControllers objectAtIndex: 0];
reader.readerDelegate = self;
reader.showsZBarControls = NO;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return(YES);
}
- (void) dealloc
{
[_window release];
[_tabBarController release];
[super dealloc];
}
// ZBarReaderDelegate
- (void) imagePickerController: (UIImagePickerController*) picker
didFinishPickingMediaWithInfo: (NSDictionary*) info
{
// do something useful with results
UITabBarController *tabs = self.tabBarController;
tabs.selectedIndex = 1;
ResultsViewController *results = [tabs.viewControllers objectAtIndex: 1];
UIImage *image = [info objectForKey: UIImagePickerControllerOriginalImage];
results.resultImage.image = image;
id <NSFastEnumeration> syms =
[info objectForKey: ZBarReaderControllerResults];
for(ZBarSymbol *sym in syms) {
results.resultText.text = sym.data;
break;
}
}
@end
|