大佬教程收集整理的这篇文章主要介绍了为什么我的滚动在 iOS Swift 中的 iPhone 12 和 iPhone 11 上不起作用,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
使用下面的代码,我可以在 iPhone 8 中滚动单元格,但是当我在 iPhone12 和 iphone11 中运行此代码时,它不会滚动但委托方法正在调用
这里的 count@H_874_8@ 参数是页面.. 每次显示 10 个单元格时.. 就像.. 当我最初到达此屏幕时,它会显示 10 个单元格,如果还有更多产品的话。它没有滚动
overrIDe func vIEwDIDLoad() {
super.vIEwDIDLoad()
// using framework
let bottomrefreshController = UIrefreshControl()
bottomrefreshController.triggerVerticalOffset = 50
bottomrefreshController.addTarget(self,action: #SELEctor(refresh),for: .valueChanged)
self.collectionVIEw.bottomrefreshControl = bottomrefreshController
self.collectionVIEw.bottomrefreshControl?.Tintcolor = .clear
}
@objc func refresh() {
serviceCall()
}
fileprivate func allProductsserviceCall(){
let param = ["params": ["category" : catID,"sub_category" : self.subCatID,"brands": brands,"count" : self.currentPagenumber
]] as [String : Any]
APIReqeustManager.sharedInstance.serviceCall(param: param,vc: self,url: getUrl(of: .all_products/*.search*/),header: header) {(responseData) in
if responseData.error != nil{
self.vIEw.maketoast(NSLocalizedString("Something went wrong!",comment: ""))
}else{
if (SearchDataModel(Dictionary: responseData.Dict as NSDictionary? ?? NSDictionary())?.result?.products ?? [Products]()).count == 0 {
self.vIEw.maketoast("No product to show!".localizeWithLanguagE)
return
}
if self.currentPagenumber > 0 {
if (SearchDataModel(Dictionary: responseData.Dict as NSDictionary? ?? NSDictionary())?.result?.products ?? [Products]()).count > 0 {
self.searchResultData?.result?.products! += SearchDataModel(Dictionary: responseData.Dict as NSDictionary? ?? NSDictionary())?.result?.products ?? [Products]()
}else {
self.vIEw.maketoast("No more products to show!".localizeWithLanguagE)
}
self.productCollectionVIEw.bottomrefreshControl?.endrefreshing()
self.currentPagenumber+=1
dispatchQueue.main.async{
self.productCollectionVIEw.reloadData()
}
}
}
}
// Scroll delegates
// Things needed for expand / collapse
func scrollVIEwDIDScroll(_ scrollVIEw: UIScrollVIEw) {
if scrollVIEw == productCollectionVIEw {
let delta = scrollVIEw.contentOffset.y - lastContentOffset
if Delta < 0 {
// move up
if scrollVIEw.contentOffset.y <= (-self.range.lowerBound) {
print("at the top")
self.productCollectionVIEw.bounces = false
topConsTraint.constant = min(topConsTraint.constant - (delta),range.upperBound)
}else {
print("at the mIDdle,moving up")
}
} else {
// move down
topConsTraint.constant = max(range.lowerBound,topConsTraint.constant - (delta))
if (scrollVIEw.contentOffset.y + scrollVIEw.frame.size.height) == scrollVIEw.contentSize.height {
print("at the end")
self.productCollectionVIEw.bounces = true
}else {
print("at the mIDdle,moving down")
}
}
lastContentOffset = scrollVIEw.contentOffset.y
}
}
@H_874_8@
代码运行良好。我的意思是我想如何在 iPhone8 中展示它的到来,但是,为什么在 iPhone12 中滚动分页不起作用。
我哪里错了...请帮忙...我被困在这里很久了
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的为什么我的滚动在 iOS Swift 中的 iPhone 12 和 iPhone 11 上不起作用全部内容,希望文章能够帮你解决为什么我的滚动在 iOS Swift 中的 iPhone 12 和 iPhone 11 上不起作用所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。