对cell中有关UITableViewCellReorderControl的所有系统方法进行答应
//
// CustomCell.m
// Test0906
//
// Created by on 2019/6/5.
// Copyright © 2019. All rights reserved.
//
#import "CustomCell.h"
@implementation CustomCell
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
NSString *type = @"UITableViewCellReorderControl";
for (UIView * view in self.subviews) {
if ([NSStringFromClass([view class]) isEqualToString:type] || [NSStringFromClass([view class]) rangeOfString: @"Reorder"].location != NSNotFound) {
NSLog(@"1️⃣%@\n\n%@", NSStringFromSelector(_cmd), view);
}
}
}
- (void)layoutSubviews {
[super layoutSubviews];
NSString *type = @"UITableViewCellReorderControl";
for (UIView * view in self.subviews) {
if ([NSStringFromClass([view class]) isEqualToString:type] || [NSStringFromClass([view class]) rangeOfString: @"Reorder"].location != NSNotFound) {
NSLog(@"2️⃣%@\n\n%@", NSStringFromSelector(_cmd), view);
view.frame = CGRectMake(200, 0, 100, 100);
}
}
}
- (void)willTransitionToState:(UITableViewCellStateMask)state {
[super willTransitionToState:state];
NSString *type = @"UITableViewCellReorderControl";
for (UIView * view in self.subviews) {
if ([NSStringFromClass([view class]) isEqualToString:type] || [NSStringFromClass([view class]) rangeOfString: @"Reorder"].location != NSNotFound) {
NSLog(@"3️⃣%@\n\n%@", NSStringFromSelector(_cmd), view);
}
}
}
- (void)didTransitionToState:(UITableViewCellStateMask)state {
[super didTransitionToState:state];
NSString *type = @"UITableViewCellReorderControl";
for (UIView * view in self.subviews) {
if ([NSStringFromClass([view class]) isEqualToString:type] || [NSStringFromClass([view class]) rangeOfString: @"Reorder"].location != NSNotFound) {
NSLog(@"4️⃣%@\n\n%@", NSStringFromSelector(_cmd), view);
}
}
}
@end
打印结果如下
2019-06-05 06:49:48.767440+0800 Test0906[46646:424235] 3️⃣willTransitionToState:
<UITableViewCellReorderControl: 0x7fb97ee01cc0; frame = (1012 0; 52 60); opaque = NO; autoresize = LM; layer = <CALayer: 0x600001301a60>>
2019-06-05 06:49:48.771530+0800 Test0906[46646:424235] 2️⃣layoutSubviews
<UITableViewCellReorderControl: 0x7fb97ee01cc0; frame = (972 0; 52 60); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x600001302080>; }; layer = <CALayer: 0x600001301a60>>
2019-06-05 06:49:48.772322+0800 Test0906[46646:424235] 1️⃣setEditing:animated:
<UITableViewCellReorderControl: 0x7fb97ee01cc0; frame = (200 0; 100 100); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x600001302080>; position-2=<CABasicAnimation: 0x60000131f040>; bounds.origin=<CABasicAnimation: 0x60000131cfe0>; bounds.size=<CABasicAnimation: 0x60000131e3a0>; }; layer = <CALayer: 0x600001301a60>>
2019-06-05 06:49:48.772978+0800 Test0906[46646:424235] 3️⃣willTransitionToState:
<UITableViewCellReorderControl: 0x7fb97ed24cc0; frame = (1012 0; 52 60); opaque = NO; autoresize = LM; layer = <CALayer: 0x60000131dd60>>
2019-06-05 06:49:48.774258+0800 Test0906[46646:424235] 2️⃣layoutSubviews
<UITableViewCellReorderControl: 0x7fb97ed24cc0; frame = (972 0; 52 60); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x6000013023c0>; }; layer = <CALayer: 0x60000131dd60>>
2019-06-05 06:49:48.775103+0800 Test0906[46646:424235] 1️⃣setEditing:animated:
<UITableViewCellReorderControl: 0x7fb97ed24cc0; frame = (200 0; 100 100); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x6000013023c0>; position-2=<CABasicAnimation: 0x60000131d9e0>; bounds.origin=<CABasicAnimation: 0x60000131e8e0>; bounds.size=<CABasicAnimation: 0x60000131f640>; }; layer = <CALayer: 0x60000131dd60>>
2019-06-05 06:49:48.784479+0800 Test0906[46646:424235] 3️⃣willTransitionToState:
<UITableViewCellReorderControl: 0x7fb97ed29e80; frame = (1012 0; 52 60); opaque = NO; autoresize = LM; layer = <CALayer: 0x60000131f3c0>>
2019-06-05 06:49:48.785777+0800 Test0906[46646:424235] 2️⃣layoutSubviews
<UITableViewCellReorderControl: 0x7fb97ed29e80; frame = (972 0; 52 60); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x60000131ef00>; }; layer = <CALayer: 0x60000131f3c0>>
2019-06-05 06:49:48.786517+0800 Test0906[46646:424235] 1️⃣setEditing:animated:
<UITableViewCellReorderControl: 0x7fb97ed29e80; frame = (200 0; 100 100); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x60000131ef00>; position-2=<CABasicAnimation: 0x60000131dd20>; bounds.origin=<CABasicAnimation: 0x60000131f720>; bounds.size=<CABasicAnimation: 0x60000131f6a0>; }; layer = <CALayer: 0x60000131f3c0>>
2019-06-05 06:49:48.787217+0800 Test0906[46646:424235] 3️⃣willTransitionToState:
<UITableViewCellReorderControl: 0x7fb97ec1edf0; frame = (1012 0; 52 60); opaque = NO; autoresize = LM; layer = <CALayer: 0x6000013027c0>>
2019-06-05 06:49:48.788496+0800 Test0906[46646:424235] 2️⃣layoutSubviews
<UITableViewCellReorderControl: 0x7fb97ec1edf0; frame = (972 0; 52 60); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x600001302a60>; }; layer = <CALayer: 0x6000013027c0>>
2019-06-05 06:49:48.789227+0800 Test0906[46646:424235] 1️⃣setEditing:animated:
<UITableViewCellReorderControl: 0x7fb97ec1edf0; frame = (200 0; 100 100); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x600001302a60>; position-2=<CABasicAnimation: 0x60000131cde0>; bounds.origin=<CABasicAnimation: 0x60000131c660>; bounds.size=<CABasicAnimation: 0x60000131cd20>; }; layer = <CALayer: 0x6000013027c0>>
2019-06-05 06:49:48.790164+0800 Test0906[46646:424235] 3️⃣willTransitionToState:
<UITableViewCellReorderControl: 0x7fb97ef0ff00; frame = (1012 0; 52 60); opaque = NO; autoresize = LM; layer = <CALayer: 0x60000131d960>>
2019-06-05 06:49:48.792873+0800 Test0906[46646:424235] 2️⃣layoutSubviews
<UITableViewCellReorderControl: 0x7fb97ef0ff00; frame = (972 0; 52 60); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x600001302f80>; }; layer = <CALayer: 0x60000131d960>>
2019-06-05 06:49:48.793572+0800 Test0906[46646:424235] 1️⃣setEditing:animated:
<UITableViewCellReorderControl: 0x7fb97ef0ff00; frame = (200 0; 100 100); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x600001302f80>; position-2=<CABasicAnimation: 0x600001303340>; bounds.origin=<CABasicAnimation: 0x600001303420>; bounds.size=<CABasicAnimation: 0x600001303440>; }; layer = <CALayer: 0x60000131d960>>
2019-06-05 06:49:48.794848+0800 Test0906[46646:424235] 2️⃣layoutSubviews
<UITableViewCellReorderControl: 0x7fb97ee01cc0; frame = (972 0; 52 60); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x600001302080>; position-2=<CABasicAnimation: 0x60000131f040>; bounds.origin=<CABasicAnimation: 0x60000131cfe0>; bounds.size=<CABasicAnimation: 0x60000131e3a0>; }; layer = <CALayer: 0x600001301a60>>
2019-06-05 06:49:48.795322+0800 Test0906[46646:424235] 2️⃣layoutSubviews
<UITableViewCellReorderControl: 0x7fb97ed24cc0; frame = (972 0; 52 60); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x6000013023c0>; position-2=<CABasicAnimation: 0x60000131d9e0>; bounds.origin=<CABasicAnimation: 0x60000131e8e0>; bounds.size=<CABasicAnimation: 0x60000131f640>; }; layer = <CALayer: 0x60000131dd60>>
2019-06-05 06:49:48.795744+0800 Test0906[46646:424235] 2️⃣layoutSubviews
<UITableViewCellReorderControl: 0x7fb97ed29e80; frame = (972 0; 52 60); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x60000131ef00>; position-2=<CABasicAnimation: 0x60000131dd20>; bounds.origin=<CABasicAnimation: 0x60000131f720>; bounds.size=<CABasicAnimation: 0x60000131f6a0>; }; layer = <CALayer: 0x60000131f3c0>>
2019-06-05 06:49:48.796168+0800 Test0906[46646:424235] 2️⃣layoutSubviews
<UITableViewCellReorderControl: 0x7fb97ec1edf0; frame = (972 0; 52 60); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x600001302a60>; position-2=<CABasicAnimation: 0x60000131cde0>; bounds.origin=<CABasicAnimation: 0x60000131c660>; bounds.size=<CABasicAnimation: 0x60000131cd20>; }; layer = <CALayer: 0x6000013027c0>>
2019-06-05 06:49:48.796576+0800 Test0906[46646:424235] 2️⃣layoutSubviews
<UITableViewCellReorderControl: 0x7fb97ef0ff00; frame = (972 0; 52 60); opaque = NO; autoresize = LM; animations = { position=<CABasicAnimation: 0x600001302f80>; position-2=<CABasicAnimation: 0x600001303340>; bounds.origin=<CABasicAnimation: 0x600001303420>; bounds.size=<CABasicAnimation: 0x600001303440>; }; layer = <CALayer: 0x60000131d960>>
2019-06-05 06:49:49.100669+0800 Test0906[46646:424235] 4️⃣didTransitionToState:
<UITableViewCellReorderControl: 0x7fb97ee01cc0; frame = (200 0; 100 100); opaque = NO; autoresize = LM; layer = <CALayer: 0x600001301a60>>
2019-06-05 06:49:49.101199+0800 Test0906[46646:424235] 4️⃣didTransitionToState:
<UITableViewCellReorderControl: 0x7fb97ed24cc0; frame = (200 0; 100 100); opaque = NO; autoresize = LM; layer = <CALayer: 0x60000131dd60>>
2019-06-05 06:49:49.101660+0800 Test0906[46646:424235] 4️⃣didTransitionToState:
<UITableViewCellReorderControl: 0x7fb97ed29e80; frame = (200 0; 100 100); opaque = NO; autoresize = LM; layer = <CALayer: 0x60000131f3c0>>
2019-06-05 06:49:49.102167+0800 Test0906[46646:424235] 4️⃣didTransitionToState:
<UITableViewCellReorderControl: 0x7fb97ec1edf0; frame = (200 0; 100 100); opaque = NO; autoresize = LM; layer = <CALayer: 0x6000013027c0>>
2019-06-05 06:49:49.102492+0800 Test0906[46646:424235] 4️⃣didTransitionToState:
<UITableViewCellReorderControl: 0x7fb97ef0ff00; frame = (200 0; 100 100); opaque = NO; autoresize = LM; layer = <CALayer: 0x60000131d960>>
注意:虽然最后得到UITableViewCellReorderControl得到的地方是在didTransitionToState:方法中,但是在这个方法中修改view的frame是不起作用的
倒数第二个得到 UITableViewCellReorderControl的方法是在layoutSubviews中,尝试选择在layoutSubviews中修改UITableViewCellReorderControl的frame,成功。