Using background view for UITableViewCell in iOS 7 covers default delete button

后端 未结 6 555
[愿得一人]
[愿得一人] 2021-01-12 02:38

I am using background view for UITableviewCell which is an imageview, I am using the image view to achieve two side corners for first and last cell. It is working fine But t

6条回答
  •  佛祖请我去吃肉
    2021-01-12 03:25


    Had the exact same issue. Solved it by sending the backgroundView to back when transition starts & also again on the next runloop cycle (using dispatch_async).

    Here's the code you should add to your cell class .m file (i.e. MyCustomTableCellView.m)

    // 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];
    }
    

提交回复
热议问题