iphone - How to add a UIview above the current view controllers view? -
i have ipad application in trying barcode reading processes.when pressing button in home page presenting barcode reading viewcontrollers view this`
zbarreaderviewcontroller *reader = [zbarreaderviewcontroller new]; reader.readerdelegate = self; reader.supportedorientationsmask = zbarorientationmaskall; reader.sourcetype=uiimagepickercontrollersourcetypecamera; //reader.cameradevice = uiimagepickercontrollercameradevicefront; reader.cameraoverlayview=cameraoverlay; if( [uiimagepickercontroller iscameradeviceavailable: uiimagepickercontrollercameradevicefront ]) { reader.cameradevice = uiimagepickercontrollercameradevicefront; } zbarimagescanner *scanner = reader.scanner; reader.wantsfullscreenlayout = yes; // todo: (optional) additional reader configuration here // example: disable used i2/5 improve performance [scanner setsymbology: zbar_i25 config: zbar_cfg_enable to: 0]; reader.showszbarcontrols = no; // present , release controller [self presentmodalviewcontroller:reader animated:yes]; //[appdel.navigationcontroller pushviewcontroller:reader animated:yes]; //[reader.view addsubview:collect]; [reader.view addsubview:back]; [back addtarget:self action:@selector(backpressed:) forcontrolevents:uicontroleventtouchupinside]; [reader.view addsubview:scan]; [scan addtarget:self action:@selector(getpressed:) forcontrolevents:uicontroleventtouchupinside]; [reader release];
and when pressing scan button added reader view need add view.for doing -(ibaction)getpressed:(id)sender{[self.view addsubview:newview] }
.but not added view.can me achieve this? `
you need overlay zbar view , add button overlay view:
//set frame according requirement aoverlay = [[uiview alloc] initwithframe:cgrectmake(0.0,0.0,320.0,480.0)]; aoverlay.backgroundcolor = [uicolor clearcolor]; uibutton *abtnscan = [uibutton buttonwithtype:uibuttontyperoundedrect]; [abtnscan setframe:cgrectmake(115, 435, 80, 45)]; [abtnscan addtarget:self action:@selector(getpressed:)forcontrolevents:uicontroleventtouchupinside]; [aoverlay addsubview:abtnscan]; reader.cameraoverlayview = aoverlay; // code
Comments
Post a Comment