More Related Content
Similar to UIImagePickerController よもやま話 (20)
UIImagePickerController よもやま話
- 5. @interface CameraViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate> { UIImagePickerController* cameraController; } @property (nonatomic, assign) UIImagePickerController* cameraController; @end
- 6. #define SOURCETYPE UIImagePickerControllerSourceTypeCamera (省略) if(![UIImagePickerController isSourceTypeAvailable:SOURCETYPE]){ return; } cameraController = [[[UIImagePickerController alloc] init] retain]; cameraController.sourceType = SOURCETYPE; cameraController.delegate = self; cameraController.allowsImageEditing = NO; [self.view.superview addSubview:cameraController.view]; //[self presentModalViewController:cameraController animated:YES];
- 18. for (UIView* view in currentView.subviews) { NSLog(@"view is a %@", [view description]); } ひたすら掘ります
- 20. - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { UIView* cameraView = [viewController.view.subviews objectAtIndex:0]; UIView* cropOverlay = [cameraView.subviews objectAtIndex:3]; UIView* imgView = [cropOverlay.subviews objectAtIndex:0]; UIView* lcdLayer = [cropOverlay.subviews objectAtIndex:1]; [imgView setHidden: YES]; [lcdLayer setHidden: YES]; }
- 26. (省略) [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(checkView) userInfo:nil repeats:YES]; touchView = [[MyTouchView alloc] init]; touchView.frame = CGRectMake(0, 0, 320, 480); touchView.backgroundColor = [UIColor blueColor]; touchView.opaque = YES; touchView.alpha = 0.5; touchView.cameraviewcontroller = self; [self.view.superview addSubview:touchView]; [self.view.superview sendSubviewToBack:touchView]; }
- 27. - (void)checkView { UIView* temp; [touchView.superview sendSubviewToBack:touchView]; if ((temp = [self getViewFromArray:self.view.superview.subviews num:2]) != nil) { if((temp = [self getViewFromArray:temp.subviews num:0]) != nil) { if((temp = [self getViewFromArray:temp.subviews num:1]) != nil) { if(([[temp description] length] > 15) && ([[[temp description] substringToIndex:15] isEqualToString:@"<PLCropOverlay:"])) { [touchView.superview bringSubviewToFront:touchView]; } } } } }