Hi guys, I've pretty much added a lot to my CustomCell, its working great. However, theres one thing i cant work out..
My requirement is, for a grouped TableView, On tapping a single UITableViewCell, it should expand below, kinda animate and extend below and show more information in that cell.
On tapping an already expanded cell, it should go back to a "normal" cell state.
Any direction i can have here would be great..
also, take a look at the following code, there are variables for a cell and i'm adding an image to the cell.acccessoryVIew, however, there are some examples where they write the code of adding an image within 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;
}
thanks guys