确切的情况: 我有一个tableViewController在我的应用程序中显示为弹出窗口。
popover中的第一个单元格中有一个iCarousel(准确地说是衬里)。 https://github.com/nicklockwood/iCarousel
实现了所有数据源和委托功能。他们都被解雇了......
在iOS 11.2中,所有工作都按预期工作,但在iOS 11.3中,popover不会显示iCarousel项目。所有代表仍然开火(fe.doseSelect; didScroll)。在接口调试器模式中,我可以看到项目,但不能在设备上看到。
尝试在初始设置后重新加载数据/尝试从项目中删除所有图像并将其保留为粉红色背景/尝试强制将alpha设置为1 /尝试使用SubviewToFront /消除所有背景效果/修改tableViewController表格查看和单元格到视图。什么都行不通。最烦人的是它在界面调试器中显示,我似乎无法让它在实际设备上运行。
Popover Presentation:
let storyboard = UIStoryboard(name: "SomeSTBName", bundle: nil)
let popControllerNav = storyboard.instantiateViewController(withIdentifier: "pTVCIdentifier")
let popController = popControllerNav as! PTVC
popController.dissmissDelegate = self
popController.t = t
popController.modalPresentationStyle = UIModalPresentationStyle.popover
popController.preferredContentSize = CGSize(width: 555, height: 120)
popController.presentedFrom = presentedFrom
popControllerNav.popoverPresentationController?.permittedArrowDirections = [.up, .down]
popControllerNav.popoverPresentationController?.backgroundColor = UIColor(red: 17.0/255.0, green: 17.0/255.0, blue: 71.0/255.0, alpha: 1.0)
popControllerNav.popoverPresentationController?.popoverLayoutMargins = UIEdgeInsets.init(top: 0, left: 100, bottom: 0, right: 0)
popControllerNav.popoverPresentationController?.delegate = self
popControllerNav.popoverPresentationController?.sourceView = mySender // button
popControllerNav.popoverPresentationController?.sourceRect = mySender.bounds
if(NViewController.instance?.pressedS != nil) {
popController.popoverPresentationController?.passthroughViews = [(NViewController.instance?.pressedS)!]
}
// present the popover
self.present(popControllerNav, animated: true, completion: nil)
TVC中的行格:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var returnCell = UITableViewCell()
if let upperCarousel = tableView.dequeueReusableCell(withIdentifier: "carouselPCell") as? CaruselPCell {
let playlists = CoreDataStack.fetchAllP() as? [UP]
upperCarousel.allP = p
upperCarousel.setup()
upperCarousel.delegate = self
returnCell = upperCarousel
}
return returnCell
}
iCarousel设置:
func setup(){
carusel = iCarousel(frame: CGRect(x: -415, y: 0, width: 950, height: 125))
carusel.scrollSpeed = 0.6
carusel.centerItemWhenSelected = false
carusel.isPagingEnabled = false
carusel.type = .linear
carusel.dataSource = self
carusel.delegate = self
carusel.bounces = false
carusel.reloadData()
carusel.clipsToBounds = true
self.contentView.addSubview(carusel)
}
CGRect(x:-415,y:0,宽度:950,高度:125)因为我不希望第一个项目居中,但是对齐到左边 - 它没有&#39 ; t生成已经过测试的问题