在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
如下,一个UIContainerView内切换两个Controller,当点击登录的时候UIContainerView的视图为LoginController,当点击登记的时候UIContainerView中的视图为RegisterController 在主视图内先做两个按钮的事件。这个不用说啦。当触发按钮事件的时候调用以下代码就可以。 var newController = self.storyboard?.instantiateViewControllerWithIdentifier("RegisterController") as! RegisterController let oldController = childViewControllers.last as! UIViewController oldController.willMoveToParentViewController(nil) addChildViewController(newController) newController.view.frame = oldController.view.frame //isAnimating = true transitionFromViewController(oldController, toViewController: newController, duration: 0.1, options: UIViewAnimationOptions.TransitionNone, animations: nil, completion: { (finished) -> Void in oldController.removeFromParentViewController() newController.didMoveToParentViewController(self) //self.isAnimating = false })
|
请发表评论