gpt4 book ai didi

objective-c - 执行选择器 ARC 警告

转载 作者:可可西里 更新时间:2023-11-01 03:01:25 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
performSelector may cause a leak because its selector is unknown

我在非 ARC 中有这段代码可以正常工作,没有错误或警告:

- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents
{
// Only care about value changed controlEvent
_target = target;
_action = action;
}

- (void)setValue:(float)value
{
if (value > _maximumValue)
{
value = _maximumValue;
} else if (value < _minimumValue){
value = _minimumValue;
}

// Check range
if (value <= _maximumValue & value >= _minimumValue)
{
_value = value;
// Rotate knob to proper angle
rotation = [self calculateAngleForValue:_value];
// Rotate image
thumbImageView.transform = CGAffineTransformMakeRotation(rotation);
}
if (continuous)
{
[_target performSelector:_action withObject:self]; //warning here
}
}

但是,在我将项目转换为 ARC 后,我收到此警告:

“执行选择器可能会导致泄漏,因为它的选择器是未知的。”

我会很感激关于如何相应地修改我的代码的想法..

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com