//Cell的点击事件
let rect = targetCell.convert(targetCell.chatImageView.frame, to: self.listTableView)
let rect2 = self.listTableView.convert(rect, to: self.view)
//获取状态栏的rect
let statusRect = UIApplication.shared.statusBarFrame
//获取导航栏的rect
let navRect = self.navigationController?.navigationBar.frame
let navBarHeight = statusRect.height + (navRect?.height)!
let tapFrame = CGRect.init(x: rect2.origin.x, y: rect2.origin.y + navBarHeight, width: rect2.width, height: rect2.height)
let image = targetCell.chatImageView.image
showZoomImageView(image, tapFrame:tapFrame)
//图片缩放动画
func showZoomImageView(image:UIImage, tapFrame:CGRect) {
let bgView = UIScrollView.init(frame: UIScreen.main.bounds)
bgView.backgroundColor = UIColor.clear
let tapBg = UITapGestureRecognizer.init(target: self, action: #selector(tapBgView(tapBgRecognizer:)))
bgView.addGestureRecognizer(ta
swift 点击图片预览,有放大缩小动画
最新推荐文章于 2023-03-22 09:36:52 发布