长按桌面视图时崩溃

时间:2011-11-04 14:24:17

标签: iphone uitableview calayer uigesturerecognizer

我有一个具有自定义单元格的tableview,一个单元格包含uiimageview,uilabels。当我按下并按住并移动uitableviewcell时,有时我会遇到此日志崩溃。如何删除此崩溃。我没有在我的应用程序中使用任何手势识别器,也没有使用任何水龙头或触摸检测。我只使用tableview委托和数据源方法。 Thanx任何帮助!

'-[CALayer _longPressGestureRecognized:]: unrecognized selector sent to instance 0x10d060'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x367cd64f __exceptionPreprocess + 114
    1   libobjc.A.dylib                     0x33a26c5d objc_exception_throw + 24
    2   CoreFoundation                      0x367d11bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
    3   CoreFoundation                      0x367d0649 ___forwarding___ + 508
    4   CoreFoundation                      0x36747180 _CF_forwarding_prep_0 + 48
    5   CoreFoundation                      0x3673af03 -[NSObject(NSObject) performSelector:withObject:] + 22
    6   UIKit                               0x35649f93 -[UIGestureRecognizer _updateGestureWithEvent:] + 562
    7   UIKit                               0x35649d57 -[UIGestureRecognizer _delayedUpdateGesture] + 22
    8   UIKit                               0x355b4afd _UIGestureRecognizerUpdateObserver + 436
    9   CoreFoundation                      0x367a4a35 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 16
    10  CoreFoundation                      0x367a6465 __CFRunLoopDoObservers + 412
    11  CoreFoundation                      0x367a775b __CFRunLoopRun + 854
    12  CoreFoundation                      0x36737ec3 CFRunLoopRunSpecific + 230
    13  CoreFoundation                      0x36737dcb CFRunLoopRunInMode + 58
    14  GraphicsServices                    0x35ef141f GSEventRunModal + 114
    15  GraphicsServices                    0x35ef14cb GSEventRun + 62
    16  UIKit                               0x355e1d69 -[UIApplication _run] + 404
    17  UIKit                               0x355df807 UIApplicationMain + 670
    18  MyAppName                          0x000029a7 main + 70
    19  MyAppName                          0x0000295c start + 40
)

2 个答案:

答案 0 :(得分:0)

您是否可以发布有关如何宣布您的tableview的更多详细信息?如果它被声明为可编辑,那么您可以使用单元格右端的三条线长按并拖动它,否则它会崩溃,因为视图不知道如何处理长按手势

答案 1 :(得分:0)

您可以尝试通过在单元格中添加一个来拦截呼叫。这与在编辑模式下拖动和移动单元格的能力不冲突。我的桌子适合两者。

在我的 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

我在每个单元格中附加一个:

UILongPressGestureRecognizer *longPressGesture =
[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
[cell addGestureRecognizer:longPressGesture];
[longPressGesture release];
相关问题