【发布时间】:2015-09-26 04:42:15
【问题描述】:
苹果:
// the action cannot be NULL. Note that the target is not retained.
- (void)addTarget:(nullable id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents;
请注意,不保留目标。
在 UIControl+BlocksKit.m 中
BKControlWrapper *target = [[BKControlWrapper alloc] initWithHandler:handler forControlEvents:controlEvents];
[handlers addObject:target];
[self addTarget:target action:@selector(invoke:) forControlEvents:controlEvents];
那么UIControl如何管理目标,为什么目标没有释放?
【问题讨论】:
-
UIControl 目标没有被释放,因为它没有被保留。