在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
QQ侧滑实现架构: 5.SliderViewController(用于控制侧滑动画,控制左右侧栏的显示和隐藏) 1 import UIKit 2 class SliderViewController: UIViewController { 3 4 var mainContentView:UIView! 5 var leftSideView:UIView! 6 var rightSideView:UIView! 7 8 override func viewDidLoad() { 9 super.viewDidLoad(); 10 initSubViews() 11 // showLeftViewController() 12 } 13 //在self.View上添加左中右三个视图 14 func initSubViews() 15 { 16 let viewRect=self.view.bounds 17 rightSideView=UIView(frame:viewRect) 18 rightSideView.backgroundColor=UIColor.blueColor() 19 self.view.addSubview(rightSideView) 20 leftSideView=UIView(frame:viewRect) 21 leftSideView.backgroundColor=UIColor.yellowColor() 22 self.view.addSubview(leftSideView) 23 mainContentView=UIView(frame:viewRect) 24 mainContentView.backgroundColor=UIColor.redColor() 25 self.view.addSubview(mainContentView) 26 } 27 28 //显示左侧Controller 29 func showLeftViewController() 30 { 31 let translateX:CGFloat=200 32 let transcale:CGFloat=0.85 33 var transT:CGAffineTransform=CGAffineTransformMakeTranslation(translateX, 0) 34 var scaleT:CGAffineTransform=CGAffineTransformMakeScale(transcale, transcale) 35 var conT:CGAffineTransform=CGAffineTransformConcat(transT, scaleT) 36 UIView.animateWithDuration(0.8, animations: { () -> Void in 37 self.mainContentView.transform=conT 38 }) 39 } 40 }
本文出自: 转载请注明来源。 |
请发表评论