Swift3 查找视图的CGRect

Swift3 查找视图的CGRect,swift3,Swift3,我有一个视图,它是collectionView horizontal的子类。每个单元格采用全宽和全高。在每个单元格中,我都有一个按钮,无法找到它相对于viewController主视图的正确位置 我尝试过以下方法和许多其他组合,但是 guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CellIds.studyCell, for: [0,1]) as? StudyCell else { return

我有一个视图,它是collectionView horizontal的子类。每个单元格采用全宽和全高。在每个单元格中,我都有一个按钮,无法找到它相对于viewController主视图的正确位置

我尝试过以下方法和许多其他组合,但是

 guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CellIds.studyCell, for: [0,1]) as? StudyCell else { return nil }

    transition.originFrame = self.view.convert(cell.explanationButton.frame, to: self.view.superview)
    transition.presenting = true
    return transition
  }

cell.convert(cell.explanationButton.frame,to:self.view)?嗯,我认为它仍然在做一些奇怪的事情这可能是因为按钮来自不同的单元格,我将其更改为主视图。谢谢