UItableViewCell delete buttonには他のカバー層があります
12216 ワード
1つ目の解決策:
3つ目の解決策:(最も簡単で、最も直接的で、最も有効)
// Fix for iOS7, when backgroundView comes above "delete" button - (void)willTransitionToState:(UITableViewCellStateMask)state { [super willTransitionToState:state]; [self sendSubviewToBack:self.backgroundView]; dispatch_async(dispatch_get_main_queue(), ^{ [self sendSubviewToBack:self.backgroundView]; }); } - (void)didTransitionToState:(UITableViewCellStateMask)state { [super didTransitionToState:state]; [self sendSubviewToBack:self.backgroundView]; }
第2の解決策:- (void)layoutSubviews
{
[super layoutSubviews];
for (UIView *subview in self.subviews) {
for (UIView *subview2 in subview.subviews) {
if ([NSStringFromClass([subview2 class]) isEqualToString:@"UITableViewCellDeleteConfirmationView"]) { // move delete confirmation view
[subview bringSubviewToFront:subview2];
}
}
}
3つ目の解決策:(最も簡単で、最も直接的で、最も有効)
第四种解决办法:- (void)layoutSubviews { [super layoutSubviews];
if (self.isEditing) {
[self sendSubviewToBack:self.contentView];
}
}
- (void) layoutSubviews {
[super layoutSubviews];
if ([ [ [UIDevice currentDevice] systemVersion] compare: @"7.0" options: NSNumericSearch] != NSOrderedAscending) {
if (iOS7 == YES) {
self.backgroundView.frame = CGRectMake(0, self.backgroundView.frame.origin.y,
self.backgroundView.frame.size.width, self.backgroundView.frame.size.height);
}
}