사용자가 "Apple"을 선택할 때 프로젝트의 이미지를 Apple의 이미지보기에로드하려는 간단한 그룹화 된 UITableView를 만들고 있습니다.UITableView 및 항목 선택
나는 인터넷에서 몇 가지 예를 보았지만 그 밖에 무엇이 있는지 알아 내려고합니다.
의견을 보내 주시면 대단히 감사하겠습니다. 감사.
사용자가 "Apple"을 선택할 때 프로젝트의 이미지를 Apple의 이미지보기에로드하려는 간단한 그룹화 된 UITableView를 만들고 있습니다.UITableView 및 항목 선택
나는 인터넷에서 몇 가지 예를 보았지만 그 밖에 무엇이 있는지 알아 내려고합니다.
의견을 보내 주시면 대단히 감사하겠습니다. 감사.
하나는 cell.imageView.highlightedImage
설정하거나 didSelectRowAtIndexPath
방법으로, 일부 [UIImage imageNamed:@"myImage.png"]
에 무기 호에서 cell.imageView.image
을 변경
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *kCustomCellID = @"com.me.foo.cell";
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCustomCellID] autorelease];
cell.textLabel.highlightedTextColor = [UIColor blueColor];
cell.imageView.image = nil;
cell.imageView.highlightedImage = [UIImage imageNamed:@"myImage.png"];
return cell;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(iPadRootViewControllerTableCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.imageView.contentMode = UIViewContentModeScaleAspectFit;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Do this if you didnt set the highlightedImage in cellForRowAtIndexPath
// [self tableView:tableView cellForRowAtIndexPath:indexPath].imageView.image = [UIImage imageNamed:@"myApple.png"];
}
무엇합니까 willDisplayCell : forRowAtIndeaPath :합니까? – user523234
셀 바로 앞에 호출됩니다. 그것은 어디서 UI 변경 내용을 셀 변경 내용을 않습니다. – chown
여기서 배우려고하는 것이 명확하지 않습니다. 테이블 선택 ('-tableView : didSelectRowAtIndexPath :')을 감지하고'UIImageView' ('-setImage :')에 이미지를 표시하는 것은 간단합니다. 어디에서 문제가 있습니까? 어떤 샘플을 보았습니까? 다른 솔루션을 찾고자하는 샘플은 어떻습니까? – jemmons