iphoneアプリケーションでIndexpath.rowの値が更新されない
私はプログラムで作成されたテーブルビューで選択された行に基づいて何かを行うindexPath.row値(didselectedrowatindexpathメソッドの外)を取得しようとしています。
didselectedrowatindexpathメソッドからindexpath.rowにアクセスする必要があります。if/elseがindexpath.rowに基づいてアクションを定義します。
アプリケーション内に7枚のカードイメージと1つの[メニューリスト]テーブルビューがあります。ユーザーがテーブルビューの行をクリックするたびに画像をタッチする必要がある場合
私はこのコードを使ってIndexPath.row値を取得しようとしています。問題は、indexPath.rowの値が毎回更新されていないことです。それはちょうど古い価値を取っている。この問題の解決方法をご提案ください。
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
{
NSUInteger nSection =[myTableView numberOfSections]-1 ;
NSUInteger nRow = [myTableView numberOfRowsInSection:nSection];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:nRow inSection:nSection];
NSLog(@"No of sections in my table view %d",nSection);
NSLog(@"No of rows in my table view %d",nRow);
NSLog(@"Value of selected indexPath Row %d", [indexPath.row]);
NSLog(@"VAlue of Array arrOperationChk %d",[arrOperationChk count]);
}
こんにちは、ようこそ。 これらの行があるメソッドで質問を編集すると、問題を解決するのが簡単になると思います。 –