我可以在编辑样式中更改tableviewcell时删除按钮的位置,使用以下代码
- (void)didTransitionToState:(UITableViewCellStateMask)state
{
[super didTransitionToState:state];
if(state == UITableViewCellStateShowingDeleteConfirmationMask)
{
for (UIView *v in [self subviews])
{
if([NSStringFromClass([v class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"])
{
NSLog(@"find");
CGRect f = v.frame;
deleteView = v;
NSLog(@"delete view %@",[deleteView description]);
v.backgroundColor = [UIColor grayColor];
v.frame = CGRectMake(200, 10, f.size.width, f.size.height);
UIControl *vs = [[v subviews]objectAtIndex:0];
CGRect fs = vs.frame;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1];
fs.origin.x -=20;
vs.frame = fs;
[UIView commitAnimations];
}
}
}
}
使用这种方式我可以改变删除按钮的位置。但是每次出现删除按钮时,它都会从我的tableviewcell的右侧移动animation
,最后它位于我指定的位置.....我只想在它出现之前设置按钮帧,但现在我不知道。我的英语很差...谢谢大家..提前谢谢
答案 0 :(得分:1)
有两条消息:tableView:willBeginEditingRowAtIndexPath:
和tableView:didEndEditingRowAtIndexPath:
。
我认为您可以使用delegate
相应地更新表格视图的外观。