可定制的UIModalTransitionStyle Swift 4

时间:2017-09-25 17:15:39

标签: ios swift uimodaltransitionstyle

有没有办法在函数中轻松制作可自定义的UIModalTranstitionStyle,以便在呈现函数时可以为多个viewControllers定制和重用该函数

示例:

func customTransition() -> UIModalTransitionStyle  {
        //other things here to customize transition
    }

它只是标准.crossdissolve,.fliphorizo​​ntal和所有那些不是我需要的所以我只是想知道你是否可以,因为我用UIView做了

func popIn(yourView : UIView) {

        yourView.transform = CGAffineTransform(scaleX: 0.01, y: 0.01)
        UIView.animateKeyframes(withDuration: 0.2, delay: 0.0, options: UIViewKeyframeAnimationOptions.calculationModeDiscrete, animations: {
            yourView.transform = .identity
        }, completion: nil)
        self.view.addSubview(yourView)
    }

1 个答案:

答案 0 :(得分:2)

编写自定义演示文稿转换的方法是编写自定义演示文稿转换。这样做的过程很简单,并且有详细记录:

  • 设置 import java.io.*; import java.net.*; class DateClient { public static void main(String args[]) throws Exception { Socket soc=new Socket(InetAddress.getLocalHost(),5217); BufferedReader in=new BufferedReader(new InputStreamReader(soc.getInputStream() )); System.out.println(in.readLine()); } } import java.net.*; import java.io.*; import java.util.*; class DateServer { public static void main(String args[]) throws Exception { ServerSocket s=new ServerSocket(5217); while(true) { System.out.println("Waiting For Connection ..."); Socket soc=s.accept(); DataOutputStream out=new DataOutputStream(soc.getOutputStream()); out.writeBytes("Server Date: " + (new Date()).toString() + "\n"); out.close(); soc.close(); } } } THIS IS OUTPUT output:= Exception in thread "main" java.net.ConnectException: Connection timed out: conn ect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.<init>(Unknown Source) at java.net.Socket.<init>(Unknown Source) at DateClient.main(DateClient.java:8)

  • 实施transitioningDelegate

  • 提供动画控制器对象

如果您不喜欢(“一堆NSObject并编写超级复杂的东西”?),那么不要尝试自定义演示过渡。相反,如果你想要一个自定义过渡动画,那么就做一个制作过程动画。