ios 7.1点击标签栏上的“更多”按钮时发生崩溃

时间:2014-03-25 04:08:14

标签: ios crash uitabbarcontroller unrecognized-selector

当点击标签栏上的“更多”按钮时,我遇到了崩溃错误。它恰好发生在iOS 7.1上。

我创建了一个类(MoreTableViewDelegate),它覆盖了更多表视图的UITableViewDelegate

MoreNavigationController
UIViewController *moreViewController =       tabBarController.moreNavigationController.topViewController;

UITableView *moreTableView = (UITableView*)moreViewController.view;

MoreTableViewDelegate *objMoreDelegate=[[MoreTableViewDelegate alloc]initWithDelegate:moreTableView.delegate];

moreTableView.delegate=objMoreDelegate;

这是MoreTableViewDelegate的详细信息:

-(MoreTableViewDelegate *) initWithDelegate:(id<UITableViewDelegate>) delegate
{

originalDelegate=delegate;
[super init];


    return self;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

{   
    if(isPoweredByMobicart==YES)
   {
        return 50; 
   }
else

{
       return 60; 
    }

}   

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{
return [originalDelegate tableView:tableView didSelectRowAtIndexPath:indexPath];
}   

但是当我点击标签栏上的“更多”按钮时,它已经崩溃了,这就是日志:

-[MoreTableViewDelegate _layoutCells]: unrecognized selector sent to instance 0xce7f300
2014-03-25 11:03:12.360 ForeverInt[961:90b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MoreTableViewDelegate _layoutCells]: unrecognized selector sent to instance 0xce7f300'
*** First throw call stack:
(
    0   CoreFoundation                      0x0336b1e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x02ee18e5 objc_exception_throw + 44
    2   CoreFoundation                      0x03408243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x0335b50b ___forwarding___ + 1019
    4   CoreFoundation                      0x0335b0ee _CF_forwarding_prep_0 + 14
    5   UIKit                               0x00bcc785 -[_UIMoreListTableView didMoveToWindow] + 108
    6   UIKit                               0x00adb478 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1642
    7   UIKit                               0x00aed68b -[UIScrollView _didMoveFromWindow:toWindow:] + 65
    8   UIKit                               0x00adb109 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 763
    9   UIKit                               0x00ad296f __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 158
    10  UIKit                               0x00ad27fb -[UIView(Hierarchy) _postMovedFromSuperview:] + 260
    11  UIKit                               0x00adddd4 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1875
    12  UIKit                               0x00ad0dba -[UIView(Hierarchy) addSubview:] + 56
    13  UIKit                               0x00db6c5b -[UINavigationTransitionView transition:fromView:toView:] + 501
    14  UIKit                               0x00db6a5e -[UINavigationTransitionView transition:toView:] + 55
    15  UIKit                               0x00bb7577 -[UINavigationController _startTransition:fromViewController:toViewController:] + 3186
    16  UIKit                               0x00bb78cc -[UINavigationController _startDeferredTransitionIfNeeded:] + 645
    17  UIKit                               0x00bb84e9 -[UINavigationController __viewWillLayoutSubviews] + 57
    18  UIKit                               0x00cf90d1 -[UILayoutContainerView layoutSubviews] + 213
    19  UIKit                               0x00ae0964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
    20  libobjc.A.dylib                     0x02ef382b -[NSObject performSelector:withObject:] + 70
    21  QuartzCore                          0x01d9d45a -[CALayer layoutSublayers] + 148
    22  QuartzCore                          0x01d91244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    23  QuartzCore                          0x01d910b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
    24  QuartzCore                          0x01cf77fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
    25  QuartzCore                          0x01cf8b85 _ZN2CA11Transaction6commitEv + 393
    26  QuartzCore                          0x01db65b0 +[CATransaction flush] + 52
    27  UIKit                               0x00a6f9bb _UIApplicationHandleEventQueue + 13095
    28  CoreFoundation                      0x032f477f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    29  CoreFoundation                      0x032f410b __CFRunLoopDoSources0 + 235
    30  CoreFoundation                      0x033111ae __CFRunLoopRun + 910
    31  CoreFoundation                      0x033109d3 CFRunLoopRunSpecific + 467
    32  CoreFoundation                      0x033107eb CFRunLoopRunInMode + 123
    33  GraphicsServices                    0x035c85ee GSEventRunModal + 192
    34  GraphicsServices                    0x035c842b GSEventRun + 104
    35  UIKit                               0x00a71f9b UIApplicationMain + 1225
    36  ForeverInt                          0x00086b9d main + 125
    37  ForeverInt                          0x000030d5 start + 53
)
libc++abi.dylib: terminating with uncaught exception of type NSException

如何解决这个问题?请帮帮我。

0 个答案:

没有答案