zoukankan      html  css  js  c++  java
  • UITableViewCell delete button 上有其它覆盖层

    第一种解决办法:

    // 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];
    }
    第二种解决办法:

    - (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];
    
            }
        }
    }
    第三种解决办法:(最简单,最直接,最有效)

    - (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);
        }
    }

    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    CSS(22)CSS的长度单位
    CSS(21)CSS Grid网格布局
    CSS(20)CSS3 弹性盒子(Flex Box)
    CSS(19)CSS3 多列
    CSS(18)CSS3 过渡与动画
    CSS(17)CSS 2D、3D 转换
    CSS(16)CSS3 渐变(Gradients)
    CSS(15)CSS媒体查询Media Queries
    CSS(14)CSS 伪元素
    CSS(13)CSS 伪类(Pseudo-classes)
  • 原文地址:https://www.cnblogs.com/zsw-1993/p/4879623.html
Copyright © 2011-2022 走看看