在Swift中自动化

时间:2017-05-04 11:58:42

标签: objective-c swift3

如何在swift中编写下面的代码。请帮忙。

        UIView* destView = ((UIViewController *)segue.destinationViewController).view;
        destView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        destView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);

谢谢!

1 个答案:

答案 0 :(得分:1)

签出代码(Swift 3.1):

var destView: UIView? = (segue.destination as? UIViewController)?.view
destView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
destView?.frame = CGRect(x: CGFloat(0), y: CGFloat(0), width: CGFloat(view.frame.size.width), height: CGFloat(view.frame.size.height))