【问题标题】:Pass from a child Viewcontroller (Tab) to a view controller从子视图控制器(选项卡)传递到视图控制器
【发布时间】:2015-07-04 14:09:27
【问题描述】:

我有一个带有 5 个子视图控制器 (B) 的选项卡 ViewController(A) 我想从我的一个子视图控制器传递到我在故事板 (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

【问题讨论】:

    标签: ios objective-c iphone uiviewcontroller


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-13
      • 1970-01-01
      • 1970-01-01
      • 2018-12-23
      相关资源
      最近更新 更多