What should I do if I enable the camera and perform human-computer interaction during the iPhone application?
Let's talk about a method that we use first. This is useful for a single application, that is, to directly enable the camera in *** appdelegate. The specific method is to define the direction of a uiimagepickerviewcontroller in the application proxy and then display it to the window. The details are as follows (it should be noted here that walktextviewcontroller inherits from uiimagepickerviewcontroller to hide certain control key areas on uiimagepickerviewcontroller ):
Extends textappdelegate. h
@ Class extends textviewcontroller;
@ Interface into textappdelegate: nsobject <uiapplicationdelegate> {
Uiwindow * window;
Extends textviewcontroller * viewcontroller;
Uinavigationcontroller * navigationcontroller;
}
@ Property (nonatomic, retain) iboutlet uiwindow * window;
@ Property (nonatomic, retain) iboutlet extends textviewcontroller * viewcontroller;
@ Property (nonatomic, retain) iboutlet uinavigationcontroller * navigationcontroller;
Extends textappdelegate. m
-(Void) applicationdidfinishlaunching :( uiapplication *) Application {
// Override point for customization after app launch
[Window addsubview: viewcontroller. View];
[Window addsubview: [navigationcontroller view];
[Window makekeyandvisible];
}
In this way, you can solve some memory release problems. Next we will look at a way of processing in integration. We also use
Extends textviewcontroller. The processing method is similar to the above. Specifically, the following code is added to viewdidload:
Imagepicker = [[using textviewcontroller alloc] init];
Imagepicker. sourcetype = uiimagepickercontrollersourcetypecamera;
Imagepicker. showscameracontrols = no;
Self. navigationcontroller. View. backgroundcolor = [uicolor clearcolor];
Self. View. backgroundcolor = [uicolor clearcolor];
[[Uiapplication sharedapplication]. keywindow addsubview: imagepicker. View];
Here
Imagepicker is used
Defined by walktextviewcontroller.
Of course, we can make a view to implement all the operations and set its transparency. Then, we can add this view to the view of the object defined by uiimagepickerviewcontroller.
Okay, that's it.