Guest User

Untitled

a guest
Jan 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. -(void)takePicure
  2.  
  3. UIImagePickerController *picker = [[UIImagePickerController alloc] init];
  4. picker.sourceType = UIImagePickerControllerSourceTypeCamera;
  5. picker.showsCameraControls = NO;
  6.  
  7. UIView *cameraControlsView = [[UIView alloc] initWithFrame:controlsFrame];
  8. UIButton *captureButton = [[UIButton alloc] initWithFrame:buttonFrame];
  9. [captureButton setTitle:@"Capture" forState:UIControlStateNormal];
  10. [captureButton addTarget:self action:@selector(buttonPressed:)
  11. forControlEvents:UIControlEventTouchUpInside];
  12. [cameraControlsView addSubview:captureButton];
  13. picker.cameraOverlayView = cameraControlsView;
  14.  
  15. - (void)buttonPressed:(id)sender {
  16. [NSTimer scheduledTimerWithTimeInterval:3.0f target:self
  17. selector:@selector(timerFired:) userInfo:nil repeats:NO];
  18. }
  19.  
  20. - (void)timerFired:(NSTimer *)timer {
  21. if (whateverIsOk) {
  22. [self.picker takePicture];
  23. )
  24. }
Add Comment
Please, Sign In to add comment