Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Media Items in JSQMessageViewController's Collection cells are not showing in IOS 14

I am using JSQMessageViewController and I am facing the issue (only in ios14) that i cant see media items like Images, Video and Audio in device though these views are generating debug view hierarchy. See below attached image:-

debug view hierarchy screenshot:

enter image description here

here is the description of UIImage inside collection view cell: <UIImageView: 0x7fe7d6d95b30; frame = (20 8; 177 131); clipsToBounds = YES; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x600001ce4ec0>>

here is the screenshot attached of screen:

enter image description here

You can see the view has generated space for image, but its not showing up!

Is anyone facing this issue? how can i solve this problem. This issue is occurring in iOS 14, it works perfectly in iOS 13.

like image 609
Ali Mehdi Avatar asked Sep 21 '20 10:09

Ali Mehdi


2 Answers

You need to overwrite in JSQMessagesMediaViewBubbleImageMasker.m
method - (void)jsq_maskView:(UIView *)view withImage:(UIImage *)image and change line:

view.layer.mask = imageViewMask.layer;

to be

view.maskView = imageViewMask;

I suggest you to use category for that. For me that was solution.

like image 95
Vladimir Avatar answered Oct 19 '22 20:10

Vladimir


I would like to suggest to change like as follows along with the Vladimir answer for backward compatibility:

if (@available(iOS 14.0, *)) {
    view.maskView = imageViewMask;
} else {
    view.layer.mask = imageViewMask.layer;
}
like image 23
Mohammad Ashraful Kabir Avatar answered Oct 19 '22 20:10

Mohammad Ashraful Kabir