@objc func abcPressed() {
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: AlphabetController.storyboardIdentifier) as! AlphabetController
controller.modalPresentationStyle = .fullScreen
self.present(controller, animated: true, completion: nil)
}
}
当我按下 abcPressed 时,出现错误“故事板 (
如何通过代码识别AlphabetController?
请帮助我!谢谢你
class AlphabetController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
var collectionView: UICollectionView!
let alphabet = ["A", "Ă", "Â", "B", "C", "D", "Đ", "E", "Ê", "G", "H", "I", "K", "M", "N", "O", "Ô", "Ơ", "P", "Q", "R", "S", "T", "U", "Ư", "V", "X", "Y"]
var audioPlayer: AVAudioPlayer?
override func viewDidLoad() {
super.viewDidLoad()
}
我试过了
extension AlphabetController {
static var storyboardIdentifier: String {
return String(describing: self)
}