저는 CustomCell에 많은 기능을 추가했습니다. 요구 사항은 그룹화 된 TableView의 경우 단일 UITableViewCell을 탭하면 아래에 확장되고 아래쪽으로 약간 움직여 확장되어야하며 해당 셀에 더 많은 정보가 표시되어야합니다.터치시 확장되고 uitextfield를 포함하는 사용자 정의 UITableViewCell
이미 확장 된 셀을 누르면 "정상적인"셀 상태로 돌아갑니다.
내가 여기에있을 수있는 모든 방향이 좋을 것 ..
또한, 다음과 같은 코드를 살펴 셀에 대한 변수가 나는 그러나, cell.acccessoryVIew에 이미지를 추가 해요, 안에 이미지를 추가하는 코드를 작성하는 몇 가지 예가 있습니다 (if cell == nil) {}.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *kCustomCellID = @"MyCellDetailSym";
CustomCell *cell = (CustomCell *)[self.tableView dequeueReusableCellWithIdentifier:kCustomCellID];
if (cell == nil)
{
cell = (CustomCell *)[[[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:kCustomCellID] autorelease];
}
cell.checkNeeded = YES;
appdelegate *appDelegate = (appdelegate *)[[UIApplication sharedApplication] delegate];
customClass *nSym = (customClass *)[ArrayCache objectAtIndex:indexPath.row];
if([appDelegate.sMap containsObject:[NSString stringWithFormat:@"%d",[nSym pKey]]]) { cell.checked=YES; } else cell.checked = NO;
if([appDelegate.favoriteSymArray containsObject:[NSString stringWithFormat:@"%d",[nSym pKey]]]) { cell.starred=YES; } else cell.starred = NO;
cell.title = nSym.txtSym;
UIImage *starredImage = [UIImage imageNamed:@"Star_list_active.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
CGRect frame = CGRectMake(0.0, 0.0, starredImage.size.width + 5 , starredImage.size.height + 5);
button.frame = frame;
UIImage *image = (cell.starred) ? starredImage: [UIImage imageNamed:@"Star_list_inactive.png"];
//UIImage *newImage = [image stretchableImageWithLeftCapWidth:12.0 topCapHeight:0.0];
[button setEnabled:YES];
[button setBackgroundImage:image forState:UIControlStateNormal];
[button addTarget:self action:@selector(checkButtonTapped:event:) forControlEvents:UIControlEventTouchUpInside];
button.backgroundColor = [UIColor clearColor];
cell.accessoryView = button;
return cell;
}
들 덕분에