сбой tableview при нажатии на индекс ячейки

когда я нажимаю на ячейку, происходит прямой сбой, и я не могу перейти на ячейку didSelectRowAtIndexPath и выдает эту ошибку

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIGestureDelayedTouch tableView:didSelectRowAtIndexPath:]: unrecognized selector sent to instance 0x1294e8b0'
*** First throw call stack:
(
    0   CoreFoundation                      0x041381e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x03eb38e5 objc_exception_throw + 44
    2   CoreFoundation                      0x041d5243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x0412850b ___forwarding___ + 1019
    4   CoreFoundation                      0x041280ee _CF_forwarding_prep_0 + 14
    5   UIKit                               0x02c5d9a1 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1513
    6   UIKit                               0x02c5db14 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 279
    7   UIKit                               0x02c6210e __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
    8   UIKit                               0x02b910aa ___afterCACommitHandler_block_invoke + 15
    9   UIKit                               0x02b91055 _applyBlockToCFArrayCopiedToStack + 403
    10  UIKit                               0x02b90e76 _afterCACommitHandler + 532
    11  CoreFoundation                      0x0410036e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    12  CoreFoundation                      0x041002bf __CFRunLoopDoObservers + 399
    13  CoreFoundation                      0x040de254 __CFRunLoopRun + 1076
    14  CoreFoundation                      0x040dd9d3 CFRunLoopRunSpecific + 467
    15  CoreFoundation                      0x040dd7eb CFRunLoopRunInMode + 123
    16  GraphicsServices                    0x0480c5ee GSEventRunModal + 192
    17  GraphicsServices                    0x0480c42b GSEventRun + 104
    18  UIKit                               0x02b73f9b UIApplicationMain + 1225
    19  Translator                          0x000423ed main + 141
    20  libdyld.dylib                       0x053de701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [favouriteArray count];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 110;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *simpleTableIdentifier = @"SimpleTableCell";

    simpleTableCell *cell = (simpleTableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil)

    {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"simpleTableCell" owner:self options:nil];

        cell = [nib objectAtIndex:0];

    }


    FavouriteDC *application = [favouriteArray objectAtIndex:[indexPath row]];

    cell.lblWord.text =  application.from_Lan;

    [cell setBackgroundColor:[UIColor clearColor]];

    cell.lblMeaning.text=application.to_Lang;

    return cell;




}

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

}


- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

{


    FavouriteDC * application = [favouriteArray objectAtIndex:[indexPath row]];

    // If row is deleted, remove it from the list.

    if (editingStyle == UITableViewCellEditingStyleDelete)
    {
        GET_DBHANDLER

        [dbHandler deleteFromFavorites:application.favo_id];

        [favouriteArray removeObjectAtIndex:indexPath.row];

        // delete your data item here

        // Animate the deletion from the table.

        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] 
withRowAnimation:UITableViewRowAnimationFade];

    }

}

person SoftCoder    schedule 28.09.2014    source источник
comment
вы добавили распознаватель жестов в класс SimpleTableCell?   -  person Fawad Masud    schedule 28.09.2014
comment
нет, у меня нет распознавателя жестов   -  person SoftCoder    schedule 28.09.2014
comment
пожалуйста, помогите мне, я много пытаюсь это исправить   -  person SoftCoder    schedule 28.09.2014
comment
Как и когда вы устанавливаете делегата? Что удерживает делегата?   -  person Wain    schedule 28.09.2014
comment
Ваш макрос GET_DBHANDLER случайно не устанавливает tableView?   -  person Hot Licks    schedule 28.09.2014
comment
Я устанавливаю делегата, когда я драюсь и отбрасываю tableview @ -Wain   -  person SoftCoder    schedule 28.09.2014
comment
@ Hot Licks, я не понимаю твой вопрос?   -  person SoftCoder    schedule 28.09.2014
comment
Покажите нам макрос GET_DBHANDLER.   -  person Hot Licks    schedule 28.09.2014
comment
#define GET_DBHANDLER \ DBHandler * dbHandler = [[DBHandler alloc] init]; @Hot Licks   -  person SoftCoder    schedule 28.09.2014


Ответы (1)


Вы установили для делегата Tableview значение UITableViewDelegate с помощью раскадровки или программно?

программно установите делегат Tableview в UITableViewDelegate.

yourtableview.dataSource=self

or

с помощью раскадровки установите делегат Tableview в UITableViewDelegate  Делегат Tableview для UITableViewDelegate

person Manav    schedule 30.07.2019