Farida
(Фарида)
1
у меня есть код для выпадающего списка, но из-за большого количества информации список не пролистывается вниз, может вы мне сможете помочь
import UIKit
class TimetableEconomViewController: UIViewController, UIPopoverPresentationControllerDelegate {
@IBOutlet weak var Econom1: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
setupGestures()
}
private func setupGestures() {
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(tapped))
tapGesture.numberOfTapsRequired = 1
Econom1.addGestureRecognizer(tapGesture)
}
@objc
private func tapped(){
guard let popVC = storyboard?.instantiateViewController(withIdentifier: "popVC" ) else {return}
popVC.modalPresentationStyle = .popover
let popOverVC = popVC.popoverPresentationController
popOverVC?.delegate = self
popOverVC?.sourceView = self.Econom1
popOverVC?.sourceRect = CGRect ( x: self.Econom1.bounds.midX, y:self.Econom1.bounds.midY,width: 0, height: 0 )
popVC.preferredContentSize = CGSize(width:250, height: 250 )
self.present (popVC, animated: true)
}
}
extension ViewController: UIPopoverPresentationControllerDelegate {
func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return .none
}
}
This doesn't look like the code for a drop-down list, just the code for managing an unknown view as a pop-over.
We encourage questions about just using Apple frameworks to be asked at the Apple developer forums.
1 Like
IOOI
(Lars Sonchocky-Helldorf)
3
translated using DeepL Translate: The world's most accurate translator
I have the code for the drop-down list, but because of the amount of information the list doesn't flip down, maybe you can help me.
1 Like