Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
coderZsq committed Sep 28, 2019
1 parent 410ca98 commit 4cd05de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions SQManagement/SQManagement/UI/SQAddConnectionViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ - (void)viewDidLoad {
__weak typeof(self) weakSelf = self;
[self.headerView whenTapped:^{
UIImagePickerController *imagePickerVc = [[UIImagePickerController alloc] init];
imagePickerVc.delegate = self;
imagePickerVc.delegate = weakSelf;
imagePickerVc.allowsEditing = YES;
UIAlertController *alertVc = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:(UIAlertControllerStyleActionSheet)];
[alertVc addAction:[UIAlertAction actionWithTitle:@"立即拍摄照片" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
imagePickerVc.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerVc.cameraDevice = UIImagePickerControllerCameraDeviceRear;
[self presentViewController:imagePickerVc animated:YES completion:nil];
[weakSelf presentViewController:imagePickerVc animated:YES completion:nil];
}
}]];
[alertVc addAction:[UIAlertAction actionWithTitle:@"从相册中获取" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]){
imagePickerVc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:imagePickerVc animated:YES completion:nil];
[weakSelf presentViewController:imagePickerVc animated:YES completion:nil];
}
}]];
[alertVc addAction:[UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:nil]];
Expand Down

0 comments on commit 4cd05de

Please sign in to comment.