简体   繁体   中英

Camera view for a Controller Tabbed bar

I declared this in my header:

#import <UIKit/UIKit.h>

@interface NFNoteCamera : UIImagePickerController

@end

and receive 27 semantic issues such as

Property 'cameraCaptureMode' requires method 'cameraCaptureMode' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation

including 'allowsImageEditing', 'allowsEditing' and other camera featured issues. If i had to guess it was something i haven't imported yet. Any Ideas?

as the doc says

Important The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified, with one exception. In iOS 3.1 and later, you can assign a custom view to the cameraOverlayView property and use that view to present additional information or manage the interactions between the camera interface and your code

why dont you just implement its delegate?

@interface NFNoteCamera : ParentClass <UIImagePickerControllerDelegate>
{
   UIImagePickerController *yourPicker;  
}
@end

@implementation NFNoteCamera
-(void)anyMethod{
yourPicker = [[UIImagePickerController alloc] init];
yourPicker.delegate = self;
[yourPicker setAllowsEditing:BOOL];
              //or photo library(UIImagePickerControllerSourceTypePhotoLibrary)
yourPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:yourPicker animated:YES];
}
//delegate methods
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
       UIImage *producedImage = [info objectForKey:UIImagePickerControllerOriginalImage];
}
@end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM