【问题标题】:Flip Back to Another View on the same view controller By click the Alert Ok Button in Swift 3通过单击 Swift 3 中的 Alert Ok 按钮,翻转回同一视图控制器上的另一个视图
【发布时间】:2017-09-02 07:07:34
【问题描述】:

我想通过使用警报操作 Button 从一个视图翻转到同一视图控制器上的另一个视图。我使用下面提到的代码,但它适用于 UIButton Action 。请分享一些信息

@IBAction func Flip(_ sender: AnyObject)
{
   UIView.transition(from: View1 , to: View2, duration: 0.3, options: UIViewAnimationOptions.transitionFlipFromLeft, completion:nil)

}

【问题讨论】:

    标签: ios swift swift3 xcode8


    【解决方案1】:

    试试这个-

    let alertView = UIAlertController(title:"mainTitle", message:"mainMessage", preferredStyle: .alert)
    alertView.addAction(UIAlertAction.init(title: "subTitle", style: .default, handler: { (alertView) in
    DispatchQueue.main.async {
       UIView.transition(from: self.View1 , to: self.View2, duration: 0.3, options: UIViewAnimationOptions.transitionFlipFromLeft, completion:nil)
    }
    }))
    self.present(alertView, animated: true, completion: nil)
    

    【讨论】:

      【解决方案2】:

      是的,我这样做了,我对 UIView 的引用使用了弱属性,这会在完成时松开连接。通过使这些 UIView 引用的属性强,它可以正常工作。谢谢

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-03-29
        • 1970-01-01
        • 1970-01-01
        • 2017-03-06
        • 2017-10-02
        • 1970-01-01
        • 2017-01-01
        • 1970-01-01
        相关资源
        最近更新 更多