私はあなたが何を求めているのか分かりません。 indexPathは、作成したばかりの行のIndexPathです。この値にプロパティを設定しますが、そのプロパティには作成されたLAST行のIndexPathのみが含まれます。
に例を示すように更新:
方法1 - あなたはcellForRowAtIndexPath内から他のメソッドを呼び出すことはありません。
#import "MyViewController.h"
@interface MyViewController()
@property(nonatomic,strong) NSIndexPath *lastIndexPathCreated;
@end
@implementation MyViewController
@synthesize lastIndexPathCreated;
:あなたの.mファイルに
:この場合、あなたはタイプNSIndexPathの私有財産が必要になります(唯一のプライベートプロパティ宣言を置くことをお見せするためにMyViewControllerのインポートと@interface宣言のコードが含まれて
...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// All your other cell setup code
self.lastIndexPathCreated = indexPath;
return cell;
}
-(void)someOtherMethod {
// The last IndexPath of the row LAST created is self.lastIndexPathCreated
}
方法2:これは、あなたがcellForRowAtIndexPath内から他のいくつかのメソッドを呼び出すことを前提としています
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// All your other cell setup code
[self myOtherMethodWithIndexPath:indexPath];
return cell;
}
-(void)myOtherMethodWithIndexPath:(NSIndexPath *)lastIndexPath {
// Do something with lastIndexPath
}
希望する場合は
hey @Piero値を取得する場合や、progressviewの値を変更したい場合は、そのタグをセルからフェッチすることができます。 – Leena
しかし、どのようなインデックスがセルを持っているのか知っていますか? – Piero
progressView.tag = indexPath.rowを設定して、progressviewで何をしたいかを指定します。 – Leena