We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
博主您好,首先非常感谢您能整理出这么优秀的内容,帮助大家学习!万分感谢!
然后在第七题的第二个问中:“如何重写带 copy 关键字的 setter”,个人认为,最好在
_name = [name copy];
之前再加一个对copyWithZone:响应的判断,如:
if ([name respondsToSelector:@selector(copyWithZone:)]) { _name = [name copy]; }
不然如果真的有童鞋在使用的过程中传入一个没有服从NSCopying协议的对象,例如UIView什么的(即使有黄色警告,但如果被忽略掉的话。。。),就会造成崩溃。 您认为呢?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
博主您好,首先非常感谢您能整理出这么优秀的内容,帮助大家学习!万分感谢!
然后在第七题的第二个问中:“如何重写带 copy 关键字的 setter”,个人认为,最好在
之前再加一个对copyWithZone:响应的判断,如:
不然如果真的有童鞋在使用的过程中传入一个没有服从NSCopying协议的对象,例如UIView什么的(即使有黄色警告,但如果被忽略掉的话。。。),就会造成崩溃。
您认为呢?
The text was updated successfully, but these errors were encountered: