Skip to content

Commit 7e1a7aa

Browse files
committed
get correct anchor for opening on iPads
1 parent 20562e1 commit 7e1a7aa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ChatSecure/Classes/View Controllers/OTRMessagesViewController.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,8 +2001,17 @@ - (void)collectionView:(JSQMessagesCollectionView *)collectionView didTapMessage
20012001
[alert addAction:obj];
20022002
}];
20032003
[alert addAction:[self cancleAction]];
2004+
2005+
// Get the anchor
20042006
alert.popoverPresentationController.sourceView = self.view;
20052007
alert.popoverPresentationController.sourceRect = self.view.bounds;
2008+
UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
2009+
if ([cell isKindOfClass:[JSQMessagesCollectionViewCell class]]) {
2010+
UIView *cellContainterView = ((JSQMessagesCollectionViewCell *)cell).messageBubbleContainerView;
2011+
alert.popoverPresentationController.sourceRect = cellContainterView.bounds;
2012+
alert.popoverPresentationController.sourceView = cellContainterView;
2013+
}
2014+
20062015
[self presentViewController:alert animated:YES completion:nil];
20072016
}
20082017
}

0 commit comments

Comments
 (0)