关闭视图控制器时,插座被隐藏了

时间:2018-11-16 07:06:02

标签: ios objective-c uiimagepickercontroller outlet dismissviewcontroller

在我的应用程序中,我有一个类似于提交表单的屏幕,其中包含下拉选择器,文本字段和按钮。有两个按钮,一个是从图库中拾取图像,另一个是从相机中拾取图像。我的问题是在填充所有文本字段之后,我正在从图库中选择图像,并从显示的图库屏幕中解散后。我所有的出口都不可见,这意味着变得透明。仅在iOS 12版本中会发生这种情况,但在iOS 11版本中却能正常工作。请帮忙。  我的屏幕如下。

上传图片之前

before uploading image

上传图片后

After uploading image it looks as below.

编码语言是目标C。

我的销售网点如下。

@property (strong, nonatomic) IBOutlet UITextField *txtSubmit;
@property (strong, nonatomic) IBOutlet UITextField *txtVisitDate;
@property (strong, nonatomic) IBOutlet UITextField *txtCalimType;
@property (strong, nonatomic) IBOutlet UITextField *txtInvoiceAmount;
@property (strong, nonatomic) IBOutlet UITextField *txtServiceProvoider;
@property (strong, nonatomic) IBOutlet UITextField *txtReceiptsNo;
@property (strong, nonatomic) IBOutlet UITextField *txtDescription;
@property (strong, nonatomic) IBOutlet UIView *btnSnapClick; //weak
@property (strong, nonatomic) IBOutlet UIButton *btnCameraclick; //weak
@property (nonatomic, retain) UIImagePickerController *mediaPicker;
@property (strong, nonatomic) IBOutlet UIButton *btnUpload;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *CollectionContanst; //weak
@property (strong, nonatomic) IBOutlet UIButton *btnSubmitWithRadious; //weak
@property (strong, nonatomic) IBOutlet UICollectionView *collectionView;
@property (strong, nonatomic) IBOutlet UIBarButtonItem *sidebarButton; //weak
@property (strong, nonatomic) UIWindow *window;

我的解雇代码如下。

[self dismissViewControllerAnimated:YES completion:NULL];

尝试在View调试器中查看时出现错误,如下所示。

  

错误:无法捕获视图层次结构。详细信息:日志标题:数据   源表达式执行失败。日志详细信息:(空)

     

日志方法:-[DBGDataSourceConnectionLibViewDebugger   _executeLLDBExpression:forRequest:onPotentialThread:iteration:] _ block_invoke_2   方法:-[DBGViewDebugger updateDebugHierarchy] _block_invoke_2   请在http://bugreport.apple.com处提交此警告的错误   消息以及您可以提供的任何有用信息。 2018-11-16   15:12:32.872415 + 0530 NTUCAdeptCliniFlex [213:3848]错误:   DebugHierarchyRequest-无法取消归档请求数据并出现错误:   错误域= NSCocoaErrorDomain代码= 3840“ JSON文本未启动   带有数组或对象,并具有允许未设置片段的选项。”   UserInfo = {NSDebugDescription = JSON文本不是以数组开头或   对象和允许未设置片段的选项。}

即使屏幕为空白,当我单击某个地方时,它也显示如下。

当我单击屏幕上的某处

when i clicked somewhere on the screen

Xcode 9.2

- (void)zcImagePickerController:(ZCImagePickerController *)imagePickerController didFinishPickingMediaWithInfo:(NSArray *)info {

    BOOL isValidImage = YES;
    [self dismissPickerView];

    for (NSDictionary *imageDic in info) {
        UIImageView *imageView = [[UIImageView alloc] initWithImage:[imageDic objectForKey:UIImagePickerControllerOriginalImage]];
        imageView.contentMode = UIViewContentModeScaleAspectFit;
        NSData  *imageData = UIImageJPEGRepresentation(imageView.image, 0.4);
        double imgLength = (imageData.length);
        double imgLengthKb = imgLength/1024;
        if(imgLengthKb <= maxFileSize){
            dispatch_async(dispatch_get_main_queue(), ^{
                //update your UI stuff here.
                NSString *base64 = [imageData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
                int randomID = arc4random() % 900000 + 100000;
                NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
                [dateFormat setDateFormat:@"dd_MM_yyyy"];
                [dateFormat setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US"]];
                NSDate *currentDate = [NSDate date];
                NSString *dateString = [dateFormat stringFromDate:currentDate];
                NSString *fileName = [NSString stringWithFormat:@"%@%@%@%d%@", @"ios_upload_",dateString,@"_",randomID,@".jpg"];
                NSDictionary *dictContact =[NSDictionary dictionaryWithObjectsAndKeys:base64,@"File64ByteStream",fileName,@"FileName", nil];
                [_imageViewArray addObject:dictContact];
                self.CollectionContanst.constant=128; //128
            });
        }else{
            isValidImage = NO;
        }
    }
    [_collectionView reloadData];
//    dispatch_async(dispatch_get_main_queue(), ^{
//        [_collectionView reloadData];
//    });
    if(isValidImage  == NO){
        [self showAlertonImage];
    }
}

- (void)dismissPickerView {
    [self dismissViewControllerAnimated:NO completion:nil];
}

上面的代码用于从图库中拾取图像。

即使我使用了视图层次结构调试器,它看起来还是空白。请检查以下附件 This image is from view hierarchy

0 个答案:

没有答案