2016-02-29 26 views
0

我的工作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。

請幫我關於這個,因爲我試了很多東西&谷歌搜索,但徒勞。謝謝。

enter image description here

這表明與前&後VC

enter image description here

這說明我的NotificationVC/childVC的連接我的SWR連接。 *標記:* ChildVC按鈕通過自定義的segue連接到createNotificationVC。

+0

你能解釋一下嗎? –

+0

@KishoreKumar如果你可以請下載源代碼並運行一次,你就會知道我在說什麼。你能看到一次源代碼嗎?我已經分享了一個鏈接。 –

+0

好吧等一下我會檢查它@ G.Abhisek –

回答

0

1.SWRevealViewController具有SW_Front & SW_REAR。

2.To使用這個,你需要實現這個層次

- > swrevealviewcontroller - > swfront --->視圖 - 控制
- > swrear ---->視圖 - 控制

3.in你的情況爲什麼代碼不起作用的意思。

4.從sw_rear你必須使用這個動畫,那麼它會確定。

enter image description here

+0

正如你所看到的ChildVC的按鈕通過自定義的segue連接到createNotificationVC。而且我在VC前面添加的視圖的NotificationVC/childVC也被添加到了sw_front VC堆棧,那麼爲什麼會這樣呢? –

+0

你看看這個https://cocoapods.org/pods/SWRevealViewController –

+0

亞哥我看了一眼..我有這樣的需求本身。我是這樣連接的,因爲我想讓我的createNotificationVC在用戶滑動時充當frontVC並且它應該顯示幻燈片菜單。 –