gpt4 book ai didi

ios - 向左滑动删除单元格在 ios 8 中无法正常工作,但在 ios 7 中有效

转载 作者:行者123 更新时间:2023-12-01 18:56:01 26 4
gpt4 key购买 nike

滑动删除表格单元格无法正常工作。我必须非常快速地多次滑动才能使其正常工作。下面的代码在 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

最佳答案

我有完全相同的问题。几个小时后,我终于发现问题出在包含滑动手势识别器的导航 Controller 上。

原生评论编辑功能使用 Swipe GestureRecognizer,所以如果您有任何手势识别器,请不要忘记添加此行以允许同时进行手势识别!

- (BOOL)gestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UISwipeGestureRecognizer *)otherGestureRecognizer { return YES; }

我真的希望它会有所帮助,因为它让我发疯......

关于ios - 向左滑动删除单元格在 ios 8 中无法正常工作,但在 ios 7 中有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27155193/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com