What is the difference between “copy” and “retain”?

后端 未结 9 1932
北恋
北恋 2020-12-13 04:10

What is the difference between copy and retain for NSString?

- (void)setString:(NSString*)newString
{
    string = [ne         


        
9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 04:48

    retain attribute is specified such that it can retain the another memory i.e it can be made to point to another address also copy First copies the address and then retains it.

提交回复
热议问题