簡體   English   中英

從子級Viewcontroller(Tab)傳遞到視圖控制器

[英]Pass from a child Viewcontroller (Tab) to a view controller

我有一個選項卡ViewController(A)和5個子視圖控制器(B),我想從我的一個子視圖控制器中傳遞到另一個我在情節提要(C)中的視圖控制器

我在子視圖控制器(B)中創建了一個按鈕,並通過按故事板中的按鈕將其鏈接到我的(C),但是單擊該按鈕后,我得到的是:

2015-07-04 16:04:36.641 LoginSampleFB[1447:74036] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010d2c2c65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010cf5bbb7 objc_exception_throw + 45
    2   UIKit                               0x000000010bd37d72 -[UIStoryboardPushSegue destinationContainmentContext] + 0
    3   UIKit                               0x000000010b7ead62 -[UIApplication sendAction:to:from:forEvent:] + 75
    4   UIKit                               0x000000010b8fc50a -[UIControl _sendActionsForEvents:withEvent:] + 467
    5   UIKit                               0x000000010b8fb8d9 -[UIControl touchesEnded:withEvent:] + 522
    6   UIKit                               0x000000010b837958 -[UIWindow _sendTouchesForEvent:] + 735
    7   UIKit                               0x000000010b838282 -[UIWindow sendEvent:] + 682
    8   UIKit                               0x000000010b7fe541 -[UIApplication sendEvent:] + 246
    9   UIKit                               0x000000010b80bcdc _UIApplicationHandleEventFromQueueEvent + 18265
    10  UIKit                               0x000000010b7e659c _UIApplicationHandleEventQueue + 2066
    11  CoreFoundation                      0x000000010d1f6431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    12  CoreFoundation                      0x000000010d1ec2fd __CFRunLoopDoSources0 + 269
    13  CoreFoundation                      0x000000010d1eb934 __CFRunLoopRun + 868
    14  CoreFoundation                      0x000000010d1eb366 CFRunLoopRunSpecific + 470
    15  GraphicsServices                    0x000000010fab8a3e GSEventRunModal + 161
    16  UIKit                               0x000000010b7e98c0 UIApplicationMain + 1282
    17  LoginSampleFB                       0x000000010b4533ef main + 111
    18  libdyld.dylib                       0x000000010db5a145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

您應該將UINavigationControllers添加為選項卡,並使用ViewControllers(B)作為這些導航控制器的根。 只有這樣,您才能執行push 否則,您必須使用模式顯示,該模式顯示將部分或全部覆蓋您的Tab欄控制器。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM