How can I make a custom view of the 'delete-button' when performing commitEditingStyle within a UITableView

后端 未结 4 877
囚心锁ツ
囚心锁ツ 2021-01-03 13:20

I would like to customize the delete button which is shown when performing the \'swipe to left\'-action on a tableview cell. I currently set up a subclass of a UITableViewCe

4条回答
  •  囚心锁ツ
    2021-01-03 14:05

    Accepted answer will not work on iOS 7, as there is now UITableViewCellContentView in between. So subviews loop now should look like this(if you want to support older iOS versions too, use currently accepted answer for iOS 6.1-)

            for (UIView *subview in self.subviews) {
                for (UIView *subview2 in subview.subviews) {
                    if ([NSStringFromClass([subview2 class]) rangeOfString:@"Delete"].location != NSNotFound) {
                        // Do whatever you want here
                    }
                }
            }
    

提交回复
热议问题