Created
March 23, 2012 10:58
-
-
Save pratikshabhisikar/2169599 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
if (indexPath.row == 0) { | |
// Start video recording. | |
BOOL cameraAvailable = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]; | |
if (cameraAvailable) { | |
NSArray *availableMediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera]; | |
BOOL videoRecordingAvailable = [availableMediaTypes containsObject:(__bridge id) kUTTypeMovie]; | |
if (videoRecordingAvailable) { | |
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; | |
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; | |
imagePicker.mediaTypes = availableMediaTypes; | |
imagePicker.cameraViewTransform = CGAffineTransformMakeScale(2.0f, 2.0f); | |
imagePicker.delegate = self; | |
[self presentViewController:imagePicker animated:YES completion:^{ | |
NSLog(@"Video recording started"); | |
}]; | |
}else { | |
// Optionally display error here... | |
NSLog(@"Video Recording not available"); | |
} | |
}else { | |
// Optionally display error here... | |
NSLog(@"Camera not available"); | |
} | |
}else if (indexPath.row == 1) { | |
// Push to list of recorded movies. | |
MoviesViewController *moviesController = [[MoviesViewController alloc] initWithStyle:UITableViewStylePlain]; | |
[self.navigationController pushViewController:moviesController animated:YES]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment