- (void)viewDidLoad {
[super viewDidLoad];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"2.png"] style:UIBarButtonItemStyleBordered target:self action:nil];
self.navigationItem.rightBarButtonItem = btn;
self.navigationItem.title = @"Contacts";
sBar = [[UISearchBar alloc]initWithFrame:CGRectMake(0,0,320,30)];
sBar.delegate = self;
[self.view addSubview:sBar];
sBar.placeholder=@"Search";
searchedData = [[NSMutableArray alloc]init];
tableData = [[NSMutableArray alloc]init];
[tableData addObjectsFromArray:dataSource];
}
Run Code Online (Sandbox Code Playgroud) 我使用 Zbar SDK 并想在我的定义框架中扫描二维码和条形码,但它正在扫描屏幕的任何部分而不是我定义的框架,所以我在哪里做错了?我想在我定义的框架中进行这样的扫描。
http://www.visionsmarts.com/products/VSBarcodeReader/VSBarcodeReader.html
这是我的代码。
-(void)displayMe{
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.showsZBarControls=NO;
//////////////black area/////////////////////////
UIImage *image1 = [UIImage imageNamed:@"blackscreen.png"];
UIImageView *imageLogo1 = [[UIImageView alloc] initWithImage:image1];
imageLogo1.frame = CGRectMake(0, 0, 320, 480);
cancelLabel =[[UILabel alloc]initWithFrame:CGRectMake(0,420, 320, 60)];
cancelLabel.backgroundColor = [UIColor blackColor];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setFrame:CGRectMake(100,420, 100, 60)];
[btn setTitle:@"Cancel" forState:UIControlStateNormal];
btn.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:18];
btn.backgroundColor=[UIColor blackColor];
[btn addTarget:self action:@selector(back)
forControlEvents:UIControlEventTouchUpInside];
[cancelLabel bringSubviewToFront:btn];
[imageLogo1 addSubview:cancelLabel];
[imageLogo1 setUserInteractionEnabled:YES];
[imageLogo1 addSubview:btn];
//reader.cameraOverlayView = btn;
///////////////line/////////////////////////////
UIImage …Run Code Online (Sandbox Code Playgroud) @interface MyObject : NSObject {
NSUInteger myID;
}
@property (nonatomic) NSUInteger myID;
Run Code Online (Sandbox Code Playgroud)