推送 FrontVC 的 SWRevealViewController 不会导致动画并且不会响应通知
SWRevealViewController pushing FrontVC is not causing animation and not responding to notifications
我正在研究 SWRevealViewController,其中我有一个场景 -
演示代码link - https://www.dropbox.com/s/02fjub838hv95cr/SWRevealVC.zip?dl=0
1) 我必须在我的 FrontVC 中展示一个 ViewController 的观点*(我的故事板中的通知VC)* ].
**2)**这个孩子VC的视图有一个按钮*(createNotification)*,它通过以下方式连接到另一个viewController*(createNotificationVC)* 自定义 segue(SWRevealViewControllerSeguePushController),它有一个后退按钮
**3)** 将后退按钮用户 returns 再次按到前面 VC 并将一些消息传递到前面 VC。
对于此消息传递,我正在使用通知模式。
在我面前VC -
override func viewDidLoad()
{
super.viewDidLoad()
self.revealViewController().delegate = self
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
if self.revealViewController() != nil
{
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
self.view.addGestureRecognizer(self.revealViewController().tapGestureRecognizer())
}
let NtfctnVC = self.storyboard?.instantiateViewControllerWithIdentifier("NtfctnVC")
addChildViewController(NtfctnVC!)
NtfctnVC!.view.frame = CGRectMake(0, 0,self.customView.frame.width, self.customView.frame.height)
customView.addSubview(NtfctnVC!.view)//add the childVC's view
NtfctnVC!.didMoveToParentViewController(self)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "methodOfReceivedNotification:", name:"NotificationIdentifier", object: nil)
}
func methodOfReceivedNotification(notification: NSNotification)
{
//Take Action on Notification
let userInfo = notification.userInfo
print(userInfo!["sentTag"] as? Int)
NSNotificationCenter.defaultCenter().removeObserver(self)
}
在 createNotificationVC 的后退按钮操作中,我有 -
@IBAction func bck(sender: AnyObject)
{
let frontVC = self.storyboard?.instantiateViewControllerWithIdentifier("frontNVC") //frontNVC is the navigation controller of frontVC
NSNotificationCenter.defaultCenter().postNotificationName("NotificationIdentifier", object: nil, userInfo: ["sentTag":2])
self.revealViewController().pushFrontViewController(frontVC, animated: true)//here the frontVC is presented with no animation.
}
问题 -
1)执行自定义转场时的动画未显示。
2)通知消息没有传递到前端VC.
请帮助我解决这个问题,因为我已经尝试了很多东西和谷歌搜索,但都是徒劳的。谢谢。
这显示了我的 SWR 与前后连接 VC
这显示了我的 NotificationVC/childVC 的连接。 *Mark:*ChildVC 按钮通过自定义 segue 连接到 createNotificationVC.
1.SWRevealViewController 有 SW_Front & SW_REAR .
2.To 使用这个你需要实现这个层次结构
->swrevealviewcontroller -->swfront--->viewcontroller
-->发誓---->viewcontroller
3.in 你的代码为什么不起作用的情况意味着 .
4.From sw_rear你必须要用这个动画才行.
我正在研究 SWRevealViewController,其中我有一个场景 -
演示代码link - https://www.dropbox.com/s/02fjub838hv95cr/SWRevealVC.zip?dl=0
1) 我必须在我的 FrontVC 中展示一个 ViewController 的观点*(我的故事板中的通知VC)* ].
**2)**这个孩子VC的视图有一个按钮*(createNotification)*,它通过以下方式连接到另一个viewController*(createNotificationVC)* 自定义 segue(SWRevealViewControllerSeguePushController),它有一个后退按钮
**3)** 将后退按钮用户 returns 再次按到前面 VC 并将一些消息传递到前面 VC。
对于此消息传递,我正在使用通知模式。
在我面前VC -
override func viewDidLoad()
{
super.viewDidLoad()
self.revealViewController().delegate = self
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
if self.revealViewController() != nil
{
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
self.view.addGestureRecognizer(self.revealViewController().tapGestureRecognizer())
}
let NtfctnVC = self.storyboard?.instantiateViewControllerWithIdentifier("NtfctnVC")
addChildViewController(NtfctnVC!)
NtfctnVC!.view.frame = CGRectMake(0, 0,self.customView.frame.width, self.customView.frame.height)
customView.addSubview(NtfctnVC!.view)//add the childVC's view
NtfctnVC!.didMoveToParentViewController(self)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "methodOfReceivedNotification:", name:"NotificationIdentifier", object: nil)
}
func methodOfReceivedNotification(notification: NSNotification)
{
//Take Action on Notification
let userInfo = notification.userInfo
print(userInfo!["sentTag"] as? Int)
NSNotificationCenter.defaultCenter().removeObserver(self)
}
在 createNotificationVC 的后退按钮操作中,我有 -
@IBAction func bck(sender: AnyObject)
{
let frontVC = self.storyboard?.instantiateViewControllerWithIdentifier("frontNVC") //frontNVC is the navigation controller of frontVC
NSNotificationCenter.defaultCenter().postNotificationName("NotificationIdentifier", object: nil, userInfo: ["sentTag":2])
self.revealViewController().pushFrontViewController(frontVC, animated: true)//here the frontVC is presented with no animation.
}
问题 -
1)执行自定义转场时的动画未显示。 2)通知消息没有传递到前端VC.
请帮助我解决这个问题,因为我已经尝试了很多东西和谷歌搜索,但都是徒劳的。谢谢。
这显示了我的 SWR 与前后连接 VC
这显示了我的 NotificationVC/childVC 的连接。 *Mark:*ChildVC 按钮通过自定义 segue 连接到 createNotificationVC.
1.SWRevealViewController 有 SW_Front & SW_REAR .
2.To 使用这个你需要实现这个层次结构
->swrevealviewcontroller -->swfront--->viewcontroller
-->发誓---->viewcontroller
3.in 你的代码为什么不起作用的情况意味着 .
4.From sw_rear你必须要用这个动画才行.