从子Viewcontroller(Tab)传递到视图控制器

时间:2015-07-04 14:09:28

标签: ios objective-c iphone uiviewcontroller

我有一个带有5个子视图控制器的标签ViewController(A)(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

1 个答案:

答案 0 :(得分:0)

您应该添加UINavigationControllers作为标签,并使用ViewControllers(B)作为这些导航控制器的根。只有这样才能执行push。否则,您必须使用模态演示文稿,它将部分或全部覆盖您的Tab栏控制器。