我的工作SWRevealViewController中,我有一個場景,其中 -SWRevealViewController推FrontVC不會導致動畫以及不響應通知
演示代碼鏈接 - https://www.dropbox.com/s/02fjub838hv95cr/SWRevealVC.zip?dl=0
1)我必須提交一個ViewController的視圖*(我的故事板中的NotificationVC)*在我的FrontVC中。
** 2)**此childVC的視圖具有通過定製賽格瑞(SWRevealViewControllerSeguePushController),其中有一個後退按鈕連接到另一個的viewController *(createNotificationVC)*按鈕*(createNotification)*
** 3)**按下後退按鈕,用戶再次返回到frontVC,同時將一些消息傳遞給FrontVC。
對於此消息傳遞,我正在使用通知模式。
在我frontVC -
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(個體經營)
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)Notifications消息沒有被傳遞給frontVC。
請幫我關於這個,因爲我試了很多東西&谷歌搜索,但徒勞。謝謝。
這表明與前&後VC
這說明我的NotificationVC/childVC的連接我的SWR連接。 *標記:* ChildVC按鈕通過自定義的segue連接到createNotificationVC。
你能解釋一下嗎? –
@KishoreKumar如果你可以請下載源代碼並運行一次,你就會知道我在說什麼。你能看到一次源代碼嗎?我已經分享了一個鏈接。 –
好吧等一下我會檢查它@ G.Abhisek –