UISearchBar ios 7在取消时崩溃 [英] UISearchBar ios 7 crash on cancel

查看:94
本文介绍了UISearchBar ios 7在取消时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用UITableViewController,在表添加的搜索栏的标题视图中。在iOS 6中搜索和取消按钮对我来说很好,但在iOS 7搜索工作正常,当我点击取消按钮应用程序崩溃时,以下消息。

I am using UITableViewController , in header view of table added search bar. Search and cancel button work fine for me in iOS 6 but in iOS 7 search working fine and when i tapped on cancel button app crash with below message .

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UITableView's implementation of -layoutSubviews needs to call super.'
*** First throw call stack:
(
    0   CoreFoundation                      0x021f05e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x01f738b6 objc_exception_throw + 44
    2   CoreFoundation                      0x021f0448 +[NSException raise:format:arguments:] + 136
    3   Foundation                          0x01b53fee -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
    4   UIKit                               0x00b1f33b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 567
    5   libobjc.A.dylib                     0x01f8581f -[NSObject performSelector:withObject:] + 70
    6   QuartzCore                          0x01a392ea -[CALayer layoutSublayers] + 148
    7   QuartzCore                          0x01a2d0d4 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    8   QuartzCore                          0x01a3b715 -[CALayer(CALayerPrivate) layoutBelowIfNeeded] + 43
    9   UIKit                               0x00b11c76 -[UIView(Hierarchy) layoutBelowIfNeeded] + 595
    10  UIKit                               0x00e4be70 -[UISearchDisplayController _hoistSearchBar] + 992
    11  UIKit                               0x00e4ccb2 -[UISearchDisplayController showHideAnimationDidFinish] + 108
    12  UIKit                               0x00b00c6c -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 267
    13  UIKit                               0x00b00f58 -[UIViewAnimationState animationDidStop:finished:] + 80
    14  QuartzCore                          0x01a34a44 _ZN2CA5Layer23run_animation_callbacksEPv + 304
    15  libdispatch.dylib                   0x0249f4b0 _dispatch_client_callout + 14
    16  libdispatch.dylib                   0x0248d75e _dispatch_main_queue_callback_4CF + 340
    17  CoreFoundation                      0x02255a5e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
    18  CoreFoundation                      0x021966bb __CFRunLoopRun + 1963
    19  CoreFoundation                      0x02195ac3 CFRunLoopRunSpecific + 467
    20  CoreFoundation                      0x021958db CFRunLoopRunInMode + 123
    21  GraphicsServices                    0x033df9e2 GSEventRunModal + 192
    22  GraphicsServices                    0x033df809 GSEventRun + 104
    23  UIKit                               0x00ab4d3b UIApplicationMain + 1225
    24  uAlign                              0x00001f6d main + 141
    25  libdyld.dylib                       0x0273170d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

我正在使用storyboard和默认取消按钮。

I am using storyboard and default cancel button .

请帮忙。谢谢。

推荐答案

UITableView's implementation of -layoutSubviews needs to call super.

我认为这是问题所在。

检查所有UITableView的layoutSubviews实现,添加 [super layoutSubviews];

Check all of your UITableView's layoutSubviews implementation, add [super layoutSubviews];.

- (void)layoutSubviews{
    [super layoutSubviews];
    //to do other things
}

这篇关于UISearchBar ios 7在取消时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆