我幾乎添加了很多我的CustomCell,它的工作很好。 然而,那裏有一件事我不能工作了..自定義UITableViewCell,觸摸擴展,包括uitextfield
我的要求是,對於分組的TableView,在攻單的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;
}
謝謝你們