我想了解以下行代碼的內存管理的影響:Objective-C的內存管理問題
// in tableView:cellForRowAtIndexPath
cell.accessoryView = [[UIImageView alloc] initWithImage:
[UIImage imageNamed:@"test.png"];
我打電話alloc
這通常意味着我打電話release
地方。 UITableViewCell
的accessoryView
設置屬性是retain
所以(我認爲)該單元將「取得」UIImageView
的所有權。 關於內存管理,上面的代碼行究竟發生了什麼?