【发布时间】:2014-11-26 17:18:03
【问题描述】:
删除表格单元格的滑动无法正常工作。我必须非常快速地多次滑动才能使其正常工作。下面的代码在 ios 7 中运行。有人可以告诉我需要做什么才能让它在 ios 8 中顺利运行吗?
@implementation SimpleTableCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
-(void)willTransitionToState:(UITableViewCellStateMask)state{
[super willTransitionToState:state];
if ((state & UITableViewCellStateShowingDeleteConfirmationMask) == UITableViewCellStateShowingDeleteConfirmationMask) {
for (UIView *subview in self.subviews) {
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"]) {
UIImageView *deleteBtn = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 64, 33)];
[deleteBtn setImage:[UIImage imageNamed:@"deleteButton.png"]];
[[subview.subviews objectAtIndex:0] addSubview:deleteBtn];
}
}
}
}
@end
【问题讨论】:
标签: ios objective-c ios7 ios8