0

次のエラーが表示されます。

[NSIndexPath 行]: 割り当て解除されたインスタンス 0x13135d50 に送信されたメッセージ

私のコード:

 -(void) scrollViewDidFinishScrolling: (UIScrollView*) scrollView {
     CGPoint point = [self convertPoint:CGPointMake(self.frame.size.width/2.0, kDefaultCellHeight/2.0) toView:self.tableView];
     NSIndexPath* centerIndexPath = [self.tableView indexPathForRowAtPoint:point];

     [self.tableView selectRowAtIndexPath: centerIndexPath
                            animated: YES
                      scrollPosition: UITableViewScrollPositionTop];

     if (centerIndexPath.row != self.currentIndex.row) {
         //Hide the arrow when scrolling
         [self setCurrentIndex:centerIndexPath];
     }

     [self.arrow show:YES];
4

2 に答える 2

0

ARC を使用していない場合は currentIndex が保持されているプロパティであることを確認してください (ARC を使用している場合は strong を使用してください)。indexPathForRowAtPoint: は自動解放されたオブジェクトを返すため、他の場所で使用するために保持している場合は保持する必要があります。

于 2013-04-26T00:56:48.137 に答える