我需要为每个单元格设置动画,当用户转向从 screen1 显示 tableview 到 screen2 时。是否可以这样做,请帮助我。
提前致谢
我试过这个:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"Cell Identifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if(cell == nil)
{
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cell.png"]];
}
CATransition *transition = [CATransition animation];
transition.duration = 1;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = @"cube";
transition.subtype = kCATransitionFromBottom;
transition.delegate = self;
[cell.layer addAnimation:transition forKey:nil];
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.textLabel.text = [shopList objectAtIndex:indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleGray;
cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:14.0f];
return cell;
}