gpt4 book ai didi

Swift, Fire segue upon Orientation 旋转

转载 作者:行者123 更新时间:2023-11-28 07:16:17 25 4
gpt4 key购买 nike

我试图根据方向是横向还是纵向来触发 segue。这就是我正在使用的,但它给了我一个无法识别的选择器错误。谁能指出我正确的方向?

 viewDidLoad(){
UIDevice.currentDevice().beginGeneratingDeviceOrientationNotifications()

NSNotificationCenter.defaultCenter().addObserver(self, selector: "showScoreCard:", name: UIDeviceOrientationDidChangeNotification, object: nil)

}



func showScoreCard {
let deviceOrientation = UIDevice.currentDevice().orientation

if UIDeviceOrientationIsLandscape(deviceOrientation){
self.performSegueWithIdentifier("scorecardSegue", sender: self)

}

最佳答案

去掉 showScoreCard 字符串末尾的冒号,因为冒号表示该方法采用一个参数。

关于Swift, Fire segue upon Orientation 旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25923751/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com