// force view class to load so it may be referenced directly from NIB
[ZBarReaderView class];
return YES;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
// force view class to load so it may be referenced directly from NIB
[ZBarReaderView class];
return YES;
}
注意此代码:
[cpp] view plain copy print ?
// force view class to load so it may be referenced directly from NIB
[ZBarReaderView class];
// force view class to load so it may be referenced directly from NIB
[ZBarReaderView class];
6.在.h文件中加入 ZBarReaderViewDelegate的实现,代码如下:
[cpp] view plain copy print ?
//
// ViewController.h
// FootSafety
//
// Created by 泽宇 徐 on 12-6-12.
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
- (void) readerView: (ZBarReaderView*) view
didReadSymbols: (ZBarSymbolSet*) syms
fromImage: (UIImage*) img
{
// do something useful with results
for(ZBarSymbol *sym in syms) {
self.label.text = sym.data;
break;
}
}
这里是功能是读取照片信息,把条码放如label显示
[html] view plain copy print ?
-(void) viewDidAppear:(BOOL)animated
{
// run the reader when the view is visible
[readerView start];
}
-(void) viewDidAppear:(BOOL)animated
{
// run the reader when the view is visible
[readerView start];
}
这个是在显示视图的时候,启动摄像头,开始扫描
[html] view plain copy print ?
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// the delegate receives decode results
readerView.readerDelegate = self;
// you can use this to support the simulator
if(TARGET_IPHONE_SIMULATOR) {
cameraSim = [[ZBarCameraSimulator alloc]
initWithViewController: self];
cameraSim.readerView = readerView;
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// the delegate receives decode results
readerView.readerDelegate = self;
// you can use this to support the simulator
if(TARGET_IPHONE_SIMULATOR) {
cameraSim = [[ZBarCameraSimulator alloc]
initWithViewController: self];
cameraSim.readerView = readerView;
}
}
在初始化的时候,设置托管。
.m文件所有内容是:
[html] view plain copy print ?
//
// ViewController.m
// FootSafety
//
// Created by 泽宇 徐 on 12-6-12.
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize label;
@synthesize readerView;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// the delegate receives decode results
readerView.readerDelegate = self;
// you can use this to support the simulator
if(TARGET_IPHONE_SIMULATOR) {
cameraSim = [[ZBarCameraSimulator alloc]
initWithViewController: self];
cameraSim.readerView = readerView;
}
}
-(void) viewDidAppear:(BOOL)animated
{
// run the reader when the view is visible
[readerView start];
}
- (void) readerView: (ZBarReaderView*) view
didReadSymbols: (ZBarSymbolSet*) syms
fromImage: (UIImage*) img
{
// do something useful with results
for(ZBarSymbol *sym in syms) {
self.label.text = sym.data;
break;
}
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000777c3290, pid=5632, tid=6656
#
# JRE version: Java(TM) SE Ru
Spring 中提供一些Aware相关de接口,BeanFactoryAware、 ApplicationContextAware、ResourceLoaderAware、ServletContextAware等等,其中最常用到de匙ApplicationContextAware.实现ApplicationContextAwaredeBean,在Bean被初始后,将会被注入 Applicati
在Java项目中,我们通常会自己写一个DateUtil类,处理日期和字符串的转换,如下所示:
public class DateUtil01 {
private SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public void format(Date d
问题描述:
在实现类中的某一或某几个Override方法发生编译错误如下:
Name clash: The method put(String) of type XXXServiceImpl has the same erasure as put(String) of type XXXService but does not override it
当去掉@Over