В моем случае это потому, что я не ставил правильный sourceRect
в
- (nullable UIViewController *)previewingContext:(id <UIViewControllerPreviewing>)previewingContext
viewControllerForLocation:(CGPoint)location
И IOS использует весь вид кадра как sourceRect
, и он накладывается навигационная панель aps и строка состояния.
Например, если вы используете его в Tableview или CollectionView вы должны написать что-то вроде этого:
NSIndexPath *indexPath = [self.collectionView indexPathForItemAtPoint:location];
UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath];
// you need to check if indexPath or cell are nil
CGRect convertedRect = [cell convertRect:cell.bounds toView:self.collectionView];
previewingContext.sourceRect = convertedRect;
// and after that - return needed view controller
Swift версия:
guard let indexPath = collectionView.indexPathForItem(at: location),
let cell = collectionView.cellForItem(at: indexPath) else {
return nil
}
let convertedRect = cell.convert(cell.bounds, to: collectionView)
previewingContext.sourceRect = convertedRect
// and after that - return needed view controller
К сожалению, не делает разницу! –
проверить обновленный ответ !! – Lion
Это работает очень хорошо, спасибо! – FTFT1234