나는 당신이 무엇을 요구하고 있는지 이해하지 못한다고 생각합니다. indexPath는 방금 작성한 행의 IndexPath입니다. 이 값으로 속성을 설정했지만 해당 속성에는 만든 마지막 행의 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 :
- (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
}
: 이것은 당신이 cellForRowAtIndexPath 내에서 다른 메소드를 호출 가정
희망이 도움이
안녕하세요 @Piero는 progressview의 태그를 지정하고 값을 가져오고 싶거나 progressview의 값을 셀에서 태그로 가져 오려는 경우이 값을 변경하려고합니다. – Leena
그래,하지만 어떻게 인덱스가 셀을 가지고 있는지 알아? – Piero
progressView.tag = indexPath.row를 설정하고 progressview와 함께하고 싶은 작업을 수행하십시오. – Leena