Search code examples
ioscamerauistepper

How can I use the value of UIStepper as the value for videoMaximumDuration?


I am currently working on an a video app in which I'd like to give the user the option of setting the duration for which the video will be recorded. I am trying to implement this using a stepper button. Currently I am able to set this timer statically as follows:

    - (IBAction)captureVideo:(id)sender {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
    picker.videoMaximumDuration = 10.0f;
    [self presentViewController:picker animated:YES completion:NULL];
}
}

How can I use a stepper's value instead? Or are there any better ways of doing this?

Thanks.


Solution

  • You can see this example, You'll know how to use UIStepper.