이것은 하루의 더 좋은 날을 위해 나를 미치게했습니다.셀에 UIImageView 하위 뷰가있을 때 UITableView가 고르지 못한 스크롤을 경험합니다.
나는 UIImageViews가있는 UITableView를 가지고있다. 이 imageviews는 tableview의 cellForRow-function에 로컬로 저장된 PNG 파일을로드합니다. 이미지 뷰가있는 셀이 말하자면 스크롤 할 때 tableview에서 스크롤을 멈추는 것을 제외하고는 정상적으로 작동합니다. 나는 StackOverflow와 구글을 대답 해 주었다. 그러나 나는 짧게 생각해 냈다 - 그래서 어떤 도움도 크게 감사 할 것이다. 여기
는 CellForRow 기능에 대한 내 코드입니다 : ...- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MyIdentifier"] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
if([currSection isEqualToString:@"composer"]){
MySlide *s = [slidesArray objectAtIndex:indexPath.row];
cell.textLabel.hidden = YES;
UIImageView *whiteView = [[UIImageView alloc] initWithFrame:CGRectMake((projectsTable.frame.size.width/2)-150, 4, 204.8, 153.6)];
if([s.slideImage isEqualToString:@""] || s.slideImage == nil){
//no custom image in this cell - go with default background image
whiteView.image = [UIImage imageNamed:@"cellback2.png"];
whiteView.backgroundColor = [UIColor whiteColor];
}else{
cell.layer.shouldRasterize = YES;
cell.layer.rasterizationScale = [UIScreen mainScreen].scale;
NSData *data = [[NSData alloc] initWithContentsOfFile:s.slideImage];
UIImage *im = [[UIImage alloc] initWithData:data];
whiteView.image = im;
whiteView.image = [self imageWithImage:whiteView.image CovertToSize:CGSizeMake(204.8,153.6)];
whiteView.backgroundColor = [UIColor whiteColor];
}
[cell.contentView addSubview:whiteView];
[whiteView release];
cell.accessoryType = UITableViewCellAccessoryNone;
}
return cell;
}
이 자사의 새로운 셀, ALLOC 이미지 뷰, 형식화하는을 작성하고 추가 할 때마다 원인이 일어나고 .. 내가 깜빡 – vishy
을 if (셀 == nil) 문 안에 whiteBack을 설정하려했지만 슬라이드 이미지에 새 이미지 경로를 추가 할 때 imageview 이미지를 업데이트 할 수 없었습니다. 이 문제를 해결하는 방법에 대한 간단한 예를 들어 주시겠습니까? – PinkFloydRocks
대답에 내 코드를 확인, 업데이트했습니다 .. – vishy