NSString *strongObj = [[NSString alloc] init]; //alloc and initialze a new instance
strongObj = @"some value"; //set value to a instance
__weak NSString *weakObj = strongObj; //refer strong pointer to weak obj
strongObj = nil; //set strong object to nil and remove it from memory
strongObj = @"some value 2"; //assign a different value to strong obj
weakObj ; // weak obj still holds // @"some value" // this value event i've set the week obj pointer to nil
請看上面的代碼和評論,評論是我的觀點/假設。請澄清。iOS澄清中的強弱屬性
感謝
弱對象將保留值直到其生命期和範圍在那裏。在範圍({和})之後,它將被自動發佈,並將添加到本地或最近的autoreleasepool。那麼它將被釋放/釋放。 –
數以千計的騙局可能是:[Objective-C ARC:strong vs retain and weak vs assign](http://stackoverflow.com/questions/8927727/objective-c-arc-strong-vs-retain-and-weak -VS-分配) –