项目中使用 'MLeaksFinder',提示UITextField leak,
临时打了个补丁解决iOS11 下UITextField 私有变量的retaincycle
- (void)willMoveToWindow:(UIWindow *)newWindow
{
[super willMoveToWindow:newWindow];
if (@available(iOS 11.0, *)) {//a temp solution to fix { UITextField private-var retaincycle.}
if (!newWindow) {
NSString *keyPath = @"textContentView.provider";
[self.passwordTextField setValue:nil forKeyPath:keyPath];
}
}
}
网友评论