2016-11-13 72 views
1

我一直在這一段時間了,我很想聽聽一些潛在的解決方案。本質上,我試圖使用SWRevealViewController合併右菜單/導航,但是當我嘗試登錄到應用程序並轉到我的主屏幕/登錄登錄時,應用程序崩潰。當賽格是模態等時,該應用不會崩潰。但它會繼續崩潰,同時它會被設置爲我目前使用的插件的適當格式。斯威夫特/客觀C - performTransitionOperation崩潰

這裏是控制檯輸出時應用程序崩潰:

2016年11月12日22:21:04.861自由市場[16811:3049283] ***終止應用程序由於未捕獲的異常 'NSInvalidArgumentException',原因: ' - [Freely_Market.LoginViewController _performTransitionOperation:withViewController:動畫:]:無法識別的選擇發送到實例0x7fc71950ea30'

對於那些誰都會懷疑應用程序的UI是什麼樣子 - 在這裏:

User Interface Image

1是登錄按鈕,即用戶被傳遞到以下屏幕的位置,等待他們的信息存儲在系統中。

2是SEGUE,sw_front

3被記錄在屏幕

4是SEGUE sw_right

5是

的塞格斯設置正確的菜單,並且我認爲我走上了正確的軌道,當涉及到究竟究竟是什麼問題在這裏..

這裏是錯誤的地方,或者它是德從編碼:\

- (void)perform 
{ 
    SWRevealControllerOperation operation = SWRevealControllerOperationNone; 

    NSString *identifier = self.identifier; 
    SWRevealViewController *rvc = self.sourceViewController; 
    UIViewController *dvc = self.destinationViewController; 

    if ([identifier isEqualToString:SWSegueFrontIdentifier]) 
     operation = SWRevealControllerOperationReplaceFrontController; 

    else if ([identifier isEqualToString:SWSegueRearIdentifier]) 
     operation = SWRevealControllerOperationReplaceRearController; 

    else if ([identifier isEqualToString:SWSegueRightIdentifier]) 
     operation = SWRevealControllerOperationReplaceRightController; 

    if (operation != SWRevealControllerOperationNone) 
     [rvc _performTransitionOperation:operation withViewController:dvc animated:YES]; 
} 

所以從我所知道的,應用程序認爲它使用這個選擇:_performtransitionOperation:withViewController:animated:]

但是,這顯然不是斯威夫特,並且是Objective-C的。所以我不太清楚如何讓我的賽車實際運行。

這是在驗證用戶的登錄信息之後調用segue的地方。

} else if (username.isEqual(to: usernameV!) && password.isEqual(to: passwordV!)) { 

     self.performSegue(withIdentifier: "sw_front", sender: self) 

而這就是我卡住的地方,也許這只是Objective-C和Swift碰撞的問題?其他人已經得到這個插件工作正常沒有任何問題,但我沒有。也許這是因爲我正在驗證用戶登錄信息,然後將它傳遞到這個新屏幕上,其他人剛剛從基本屏幕開始。

任何幫助表示讚賞。

回答

0

問題解決了。

我需要在登錄確認和SWRevealViewController被調用的實例之間創建一個單獨的視圖控制器。

如果你想讀入問題上的Git倉庫爲SWRevealViewController進一步,你可以這樣做,在這裏:SWRevealViewController Issue #642

什麼,我只是講可以在這裏找到的形象圖:

enter image description here