확장 된 UITableView 인 "EasyTableView"을 사용합니다. 나는 다음과 같은 문제가 발생할 :EasyTableView 대리자 메서드에서 변수에 액세스 할 수 없습니다.
- (void)viewDidLoad
{
NSArray *array = [[NSArray alloc] initWithObjects:@"14.jpg",nil];
photos = array;
[array release];
[photos objectAtIndex:0]; //this "photos" can be access
}
하지만 난 대리인이 방법에서 "사진"에 접근하려고하면
- (void)easyTableView:(EasyTableView *)easyTableView setDataForView:(UIView *)view forIndexPath:(NSIndexPath *)indexPath {
NSInteger r = [indexPath row]; // r = 0
NSString *imagePath = [photos objectAtIndex:r]; //this line cause : reason: '-[CALayer objectAtIndex:]: unrecognized selector sent to instance
}
왜 결과는 다른 사진에 액세스 할 수? 어떻게 해결할 수 있습니까?
@property (nonatomic, retain) NSMutableArray* photos;
로 및 구현
@synthesize photos = photos;
의 속성으로
정보가 충분하지 않습니다. 사진은 어디에 정의되었으며 정의 된 방법은 무엇입니까? –
'사진 '은 어떻게 정의되어 있습니까? 객체를 올바르게 유지하려면'self.photos = array'를 사용해야 할 것 같습니다. – trojanfoe